Problem with passing relative url-path in Flash. It belongs to Java+Flash

By SrihariCh | Jul 6, 2009

actionscript3

Hi all,
I am new to Flash and ActionScript 3.0 environment. I don’t have any knowledge in depth with Flash and ActionScript 3.0.
I am using the flash(.swf file) in my Java application. Now, this .swf file is to be placed in the server system. While I am working with these, I faced an error.

Here, my issue/problem(s) starts….
1.)
With the help of URLRequest & URLLoader classes, I am loading a jpg file dynamically onto the stage using the following code:

HTML Code:

...bla  ...bla
var request:URLRequest = new URLRequest("http://localhost:8888/getviews");
//var request:URLRequest = new URLRequest("http://www.mymdworld.com:8082/getviews");
var urlLoader:URLLoader = new URLLoader();
urlLoader.dataFormat = URLLoaderDataFormat.TEXT;
urlLoader.addEventListener(Event.COMPLETE, completeHandler1);
urlLoader.load(request);

function completeHandler1(event:Event):void {
        var loader:URLLoader = URLLoader(event.target);
        var listData:String=loader.data;
        var viewswithusertype:Array=listData.split("$");
        usertype=viewswithusertype[0];
        var views:String=viewswithusertype[1];
        var users:Array = views.split(".");
        trace("users.length ="+users.length);
        for (var t=0; t<users.length; t++) {
                trace("in for loop");
                var itemname:String=users[t];
                var itemslist:Array=itemname.split(",");
                trace("itemslist: "+itemslist);
                comboBox_mc.addItem({label:itemslist[1],data:itemslist[0]});
        }
}

…bla  ..bla

//Code for loading the specific image when we click on Combo-box is added here.
… … …


So, in the above code, in the first statement, I am passing the absolute path of the servlet as a parameter(viz., http://localhost:8888/getviews). It works fine in my localhost system.

What should I do if I want to open (or) execute the same url anywhere[i.e., both locally and remotedly] from Flash?

2.)
Also,Can we pass a url_String to URLRequest & URLLoader as a relativepath instead of as an absolute_path [same as in the above case which you can see in the first line of the code above].
If so, How we can achieve this?

Please, spend few minutes of your valuable time by replying solution or atleast a hint to my problem(s).
I will be waiting for your replies…..

Thanks in advance..
Srihari.Ch

actionscript3

Please reply at our Forum

Leave a Comment

If you would like to make a comment, please fill out the form below.

Name (required)

Email (required)

Website

Comments

© 2007 ActionScript 3.0