AS3.0 UrlRequest Question

Actual path: urlRequest = new URLRequest("../anu_01/mydocuments/mypictures/"+tempArray[0]);
"anu_01"==> this changes everytime. So , I will grab that and save it to
   private var anuNumber:String="";
anuNumber= "anu_01" , so I changed the path to
urlRequest = new URLRequest("../"+anuNumber+"mydocuments/mypictures/"+tempArray[0]);
and it is not working..  how do I make it work?
can you help me in the above path.... please

this is the original code..
package{
  import flash.display.*;
  import flash.events.*;
  import flash.net.*;
  import flash.text.*;
  import flash.utils.*;
  public class Anu extends MovieClip{
   private var urlLoader:URLLoader = new URLLoader();
   private var mediaLoader:Loader = new Loader();
   private var urlRequest:URLRequest;
   private var statusField:TextField = new TextField();
   private var scoNumber:String="";
   private var xmlFile:String = "";
   private var txtFile:String = "";
   public  const XML_PATH:String = "../mydocuments/mypictures/"
   public function Anu():void{
    // Create the status TextField
    statusField.border     = false;
    statusField.background = true;
    statusField.backgroundColor = 0x000000;
    statusField.textColor = 0xffffff;
    statusField.wordWrap = true;
    statusField.width = statusField.height = 350;
     this.loaderInfo.addEventListener(Event.INIT,initEventHandler);
   private function initEventHandler(event:Event):void {
    var tempStr:String = this.loaderInfo.url; 
//the xml tag is <link1>../anu_01/swf/Anu.swf?t.xml</link1>
    var tempArray:Array = new Array();
    var tempArray1:Array = new Array();
    var tempInt:int = 0;
    //Get file name to load
    tempArray = tempStr.split("?");
    tempArray1 = tempStr.split("/");
    if(tempArray.length > 1){
     tempArray = tempArray[1].split(",");
     if(tempArray.length > 1){
      //Get XML filename
      xmlFile = tempArray[0];
      txtFile = tempArray[1];
     else{
      xmlFile = tempArray[0];
      txtFile = "";
     getXmlData();
function getXmlData():void{
anuNumber=tempArray1[1];
               urlRequest = new URLRequest("../"+anuNumber+/mydocuments/mypictures/"+tempArray[0]);
                //Setup the loader and its listener
                urlLoader.addEventListener(Event.COMPLETE,xmlCompleteHandler);
                urlLoader.addEventListener(IOErrorEvent.IO_ERROR,errorLoad);
                urlLoader.load(urlRequest);
              function errorLoad(err:IOErrorEvent):void{
                urlRequest = new URLRequest(XML_PATH+tempArray[0]);
                urlLoader.addEventListener(Event.COMPLETE,xmlCompleteHandler);
                 urlLoader.load(urlRequest);
    else{
     xmlFile = "testData.xml";
     txtFile = "";
     urlRequest = new URLRequest(xmlFile); 

Similar Messages

  • AS3.0 Question dealing w/ the stage

    I had a question if there is a way to set the stage as not visible?  Meaning the .swf stage is transperent and takes the properties of the bg image of the bg of the page its laid on?  I'm trying to steer away from just using flash for the site and using a mixture of flash elements in a css site but I can't seem to get the stage to be transparent.  Any help on this would be great.  Thanks in advance.

    What if we add
    <param name="wmode" value="transparent">
    I meant, inside html where you publish your swf.
    <object classid="clsid:bala" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="250" height="50">
    <param name="movie" value="bala.swf">
    <param name="quality" value="high">
    <param name="wmode" value="transparent">
    <embed src="bala.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="250" height="50"></embed>
    </object>

  • Adobe Air AS3 URLRequest Delay

    Hi,
    I want to make a request to read a url from my apk exported from .fla. The problem is in the first installation, then the request it takes 6 seconds. I do not know what's causing. I open the application 2nd time and request is executed in a second successful.
    I attached files and screens here: https://app.box.com/s/unue6ebsgpmkk7jb7yuc
    To reproduce the problem you need to uninstall the application and install->run again. Only on the first run is observed the problem.
    I will be grateful if someone help me
    MyConf:
    Air sdk: 16
    Flash CC:  14.1.0.96 ( windows 7 64 )
    Thanks!
    import flash.utils.Timer;
    import flash.events.Event;
    import flash.events.TimerEvent;
    import flash.events.IOErrorEvent;
    import flash.net.URLLoader;
    import flash.net.URLRequest;
    var global_status:String = "none";
    var global_magic_event:int = 0;
    var text2screen: TextField = new TextField();
    text2screen.x = 10;
    text2screen.y = 450;
    text2screen.width = 300;
    text2screen.height = 100;
    text2screen.wordWrap = true;
    text2screen.border = true;
    text2screen.textColor = 0xffffff;
    text2screen.backgroundColor = 0x000000;
    text2screen.background = true;
    text2screen.text = global_status;
    addChild(text2screen);
    var xloader: URLLoader = new URLLoader();
    var url: String = "http://pastebin.com/raw.php?i=TBwVdkFY&rnd="+randomRange(111,99999);
    trace(url);
    var request: URLRequest = new URLRequest(url);
    try {
      xloader.load(request);
      xloader.addEventListener(Event.COMPLETE, processData);
      xloader.addEventListener(IOErrorEvent.IO_ERROR, errorData);
    } catch (e: Error) {
      trace("error!!");
      global_status = "err #1";
    function processData(e:Event):void{
      trace("Loading Completed");
      global_status = "success "+xloader.data.substr(0,250);
    function errorData(e: Event = null) {
      trace("Loading fail!");
      global_status = "err #2";
    // debug screen
    var timer_start: Timer = new Timer(1000, 1000);
    timer_start.addEventListener(TimerEvent.TIMER, showlog);
    timer_start.start();
    function showlog(e: TimerEvent): void {
      // catch the second where is success
      if( global_magic_event==0 && global_status!="none" ) { global_magic_event = e.currentTarget.currentCount; }
      text2screen.text = "#" + (e.currentTarget.currentCount*e.currentTarget.delay)/1000 + " second | status ["+global_magic_event+"]: "+global_status;
    function randomRange(minNum:Number, maxNum:Number):Number  {
        return (Math.floor(Math.random() * (maxNum - minNum + 1)) + minNum);

    Hi,
    Is a small txt file ( 2.55 KB ), and i make the request with a random parameter ( &rnd ) to be uniq for each request.
    var url: String = "http://pastebin.com/raw.php?i=TBwVdkFY&rnd="+randomRange(111,99999);
    I tried on multiple servers, different files, various sizes, with cache, without cache ... the problem is not remote . ( is not a cache problem )
    I tried on multiple .fla ... the problem is not on current .fla .. is a global problem.
    I added a v2_fla folder (  https://app.box.com/s/unue6ebsgpmkk7jb7yuc ) where i implemented a complete debug.
    i added this events:
        xloader.addEventListener(Event.COMPLETE, completeHandler);
        xloader.addEventListener(Event.OPEN, openHandler);
        xloader.addEventListener(ErrorEvent.ERROR, onError)
        xloader.addEventListener(AsyncErrorEvent.ASYNC_ERROR, onAsyncError);
        xloader.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
        xloader.addEventListener(ProgressEvent.PROGRESS, progressHandler);
        xloader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
        xloader.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);
        xloader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
    and i tested in adobe_flash_player_14, air_desktop and air_16_for_android and i recorded the time when each event is executed
    adobe_flash_player_14: 0 seconds
    air_16_desktop: 0 seconds
    air_16_for_android_first_run: 5 seconds
    air_16_for_android_second_run: 0 seconds
    I noticed that Event.OPEN is executed at second 5. why ?
    this is a simple script and this delay is a big problem for me. maybe it is a bug air. can someone clarify me? I struggled with this problem for several days.
    Thanks!

  • AS3 URLRequest object properties

    I am scanning in a very old book as jpgs using the
    convention, "page_001.jpg thru page_110.jpg. Because there are so
    many pages, I am using the URLRequest to go get them one at a time.
    Is there a way you can get at the URLRequest value which would give
    me the jpg's name? I want to use a forward and backward button to
    allow the user to flip back and forth between pages so I'll need to
    loop thru them to get the next jpg.
    Is there another way to do this if I cannot use the
    URLRequest's value? How do you load jpgs into Flash w/o importing
    them in and be able to continue loading them by their file name?
    Kim

    you're welcome.

  • Adobe Flash as3 Button question...

    Hi,
    I just wonder that how can i write this code  that means if the "specific" button is clicked(i mean if the homebutton is clicked=true) like this..
    and how can i refer a button that in main stage while in an another clip's substage..
    ty all

    Please don't crosspost in these forums.  A response is offered in the AS3 forum.

  • Adobe flash cs4 as3 button question

    Hi,
    I just wonder that how can i write this code  that means if the "specific" button is clicked(i mean if the homebutton is clicked=true) like this..
    and how can i refer a button that in main stage while in an another clip's substage..
    ty all

    A button beiong clicked is an event, not a persistent state, so if you want to have some conditional outside of the button's normal event listening/handling code, then you would need to create such a property/variable.  So you could create a variable: var homeClicked:Boolean = false;  and when the button gets clicked, your event handler function could assign: homeClicked = true.  You could then use something like...
    if(homeClicked){
         // do whatever you intend
    To refer to an object in the parent timeline you can use: MovieClip(this.parent).objectName

  • Taking a break during a course and returning later.

    I am trying to figure out a way to allow a student to stop in the middle of a course that includes some short quiz questions, and return to their last location at a later date. Maybe I can use something like a "post results" in the middle of the course, but I would need to know what system variables to post.
    Is it possible to add a "POST RESULTS" button on any slide, but disguise it as an "EXIT" the course button?

    Lilybiri,
    Yes, it was the old video for conditional actions. It was very helpful. Thanks again.
    I want to apoligize for my wordiness ahead of time. Please continue reading.
    The LMS I am using involves my own design using WAMP, and modifying Adobe's internal server reporting and reading PHP files to interface with my MySql database. I also designed my PHP student Web pages for them to use when logging into my  web-portal.  I have Adobe Air installed on my Web site server. I have all the SCORM and EMCA reference guides to help get the big and small picture of what the standard LMS should look like, eventhough this Military project I am working on is not connecting to the WWW, and is currently only connected to 10 Machines. Starting small for now and eventually may turn into an  intranet web portal someday for the rest of the local Military users. 
    Getting back to the cookies. It sounds like the I need to create cookies on my user client  machines so that when the user returns, the bookmarking gets them back to their last visited location. This is the self contained approach.
    In my case, each client machine may have different user at different times or days. Saving cookies on each machine would require an array of data for each user that uses the machine when they exited. SInce I am also capturing interaction data, it gets more complicated. When the student eventually reaches the end of the course, all the interaction data that goes with each student must be retreived and included with the last slide "POST RESULT" button.
    This means the interaction data must be incrementally stored to my database as the self-paced student goes through the course slide by slide. An exit button or some form of EXIT routine must be created that triggers a routine that passes the current interaction data through an server external PHP file that parses the information to my database. This would avoid the need for the last Quiz slide and the last "POST RESULT" button.
    I can probably do most of this using AS3 URLRequest and URLLoader, but I am wondering if I can use whatever Captivate currently uses for the "POST RESULT" button?
    My LMS is a small subset of the products I've seen sold by some online vendors. This is a small project that can easily grow into a large project if I want it to. I just want to start out small for now and I don't want to waste my time "reinventing the wheel" if Captivate already provides an easy way to do this.
    So far, from the responses I am getting, it looks like I have to write my own client to server interface from Captivate to MySQL.
    Do you agree?

  • Possible to have ApplicationControlBar appear above TitleWindow?

    This is Flex 3.4/AS3/FP9 question (not Gumbo)
    Is it possible to adjust the depth/display list properties such that a component (e.g., an ApplicationControlBar ) sits above a TitleWindow? Or to rephrase, have a TitleWindow (PopupManager) not be the highest element in the display list? For my purposes the Popup is non-modal.
    I'd rather look at extending a component (but which one? the ApplicationControlBar or the PopupManager?). I've looked at components like MDICanvas and MDIWindow, but there is a significant performance hit in our application when they are used.
    Alternatively, is it possible to limit a PopupManager's "impact" to a single component/container? i.e., It's confined to the launching containers bounds/depth?
    In the AS2 days I would have swapDepths after getNextHighestDepth(),
    I hope this question makes sense.
    Richard

    Hi Paul,
    If I understand you correctly you actually want to see the grand total on your chart as a separate line, right? Unfortunately Pivot Charts do not provide that out of the box. One option would be to manually create a "normal" chart from it as described
    here but I have not tried that yet.
    Another (in my opinion) nice option to solve this is to create an "artificial" all-element in one of your slicers. This could for example be accomplished by using a date table (instead of your month/year-fields from the fact table) that is related to
    the date-field from your fact-table. You would then add another element to that date-table such as the last line from this linked table:
    Year
    2008
    2009
    2010
    2011
    2012
    2013
    All (Average)
    Using this I created a new measure based on your existing CumPercent:
    =if(HASONEVALUE('Date'[Year]),
      if(values('Date'[Year])="All (Average)",
        calculate([CumPercent],all('Date'[Year])),[CumPercent]),[CumPercent])
    If you replace your existing measure with this new one and your StartYear with the new Year-Column from our date-table, an additional all-element will Ssow up on your Pivot Chart:
    Would that help?
    Regards,
    Julian
    Julian Wissel | BI for NAV @ http://en.navbi.com | Blog @ blog.navida.eu

  • Linking between SWF files

    I need to general advice while protyping my website. I'm
    creating separate somewhat large swf files for each page of my
    website. Therefore, each will need its own html file if I don't
    want it take 3 years to go between pages. I'm confused how to link
    between the each page using a button in flash. Is this an action
    script thing? My links will be static text buttons. Thanks.

    Thanks. I think I get it, but I want to be sure. I think I
    need to be a little clearer:
    One SWF file inserted as my entire index.html page. Right now
    I have a static text button in the SWF file home page that says
    "About Us". I'm designing a new page that will also be its own SWF
    file for "About Us". I have a new www.xxxxx.com/aboutus.html page
    that I plan to put the file in when finished. In the text button on
    the homepage, do I use AS3 URLRequest("
    http://www.xxxxxxx.com/aboutus.html")
    to navigate. Thanks.

  • Fixed height, none fixed width

    I have an object which needs to be fixed in the same part of the screen (so that it does not move when the screen is scrolled)
    the page is designed with a vertical blank column so that the object is always in this column but no content ever gets moved in behind it.
    my page uses a wrapper div which is centered using margin left+right:auto;
    the problem is if I use position:fixed I also have to fix the objects left property.
    however because the main content is centered the correct left value (in ether px of %) is different for each user depending on the browser resolution.
    and obviously when i use position:relative the object does not stay fixed in the same part of the screen when the user scrolls.
    Is it possible to fix this problem without resorting to javascript?
    If i do have to use javascript would the best way be to use window.innerwidth to determine the window width, calculate the correct left value of the object, print this into the document using getelementby('ID').innerHTML and put the whole lot in a function that is constantly triggered by setinterval (so that it stays correct even if the users resizes the window)
    yes i did just say i would use getelementby('ID').innerHTML and not getelementby('ID').style, i use this as a work arround for IE not working when you set/change the style in this way.

    function(){return A.apply(null,[this].concat($A(arguments)))}
    pziecina wrote:
    Hi
    iPhone and other apple i devices do not support flash but can do so by packaging the flash as an app for these devices, (a little more complex than that, but!).
    The improvements to DW CS5.5 include the jQuery-mobile framework which enables you to produce a mobile friendly web site that also supports these devices, without having to package them as an app. You do not require CS5.5 to use the jQuery-mobile framework though, see - http://jquerymobile.com/.
    PZ
    Thats not what i meant
    with flash you have to compile your work when you have finished.
    two options which have existed for a long time are to compile to a SWF file so that it can be embeded in a HTML document and compileing to a file which acts like an EXE file that can run directly within windows.
    in flash CS5 you can compile flash programs as iphone applications.
    these are not flash files which the iphone is not able to run by default, these are programs compiled for the iphone as an aplication which were created useing AS3
    my question was
    are the updates in cs5.5 anything more than a HTML equivilant of the function cs5 introduced for flash?
    and
    has flash been upgraded let developers compile their aplications for other devices such as android devices?

  • Migrate existing code of AS3 to AS2 - URLRequest, URLLoader

    Hi,
    I have written code to read an XML file by using URLRequest and URLLoader in ActionScript 3.0. Code is pasted below. This runs well in AS3.  Problem I am facing is because I wrote this in AS3, I am not able to use the DateChooser component in another part of the flash module because it seems like DateChooser component is not supported in AS3. So I want to migrate my below AS3 code back to AS2.
    **** Code in AS3 (I need help in writing equivalent code in AS2) :-
    var xmlText:XML ;
    var xmlReq:URLRequest = new URLRequest("myFile.xml");
    var xmlLoader:URLLoader = new URLLoader();
    xmlLoader.load(xmlReq);
    xmlLoader.addEventListener(Event.COMPLETE,xmlLoaded);
    function xmlLoaded(event:Event):void
        xmlText = new XML(xmlLoader.data);  
        info_txt.htmlText = xmlText.someTag ;
    **** I cannot use the above as is because, when I change the publish settings from AS3 to AS2, I get following errors -
    The class or interface 'URLRequest' could not be loaded.
    The class or interface 'URLLoader' could not be loaded.
    The class or interface 'Event' could not be loaded.
    Same works well in AS3. What should I do to make this work in AS2 or can anyone direct me in writing an equivalent in AS2.
    Please assist.
    Thanks in advance.
    MG

    parsing is done using the xmlnode methods and properties.  how you parse an xml file (in as2) depends on its structure.  but generally, you use firstChild, nextSibling, childNodes and nodeValue in the appropriate sequence to extact data.  the flash help files have sample code.  for tutorials, check google.
    if you're trying to load a cross-domain xml file, you'll have a cross-domain security issue to deal with.

  • Does anyone know why I am getting a yellow question mark by my AS3 .swf?

    I developed a few Actionscript 3 animations in CS Flash 5 to use in Cp5.  Instead of the green ball icon in the upper right corner of the animation, I am getting a yellow question mark like I did when with my Actionscript 2 .swfs.  The reason I created new ones in AS3 was to avoid any conflict.  Hmmm
    The new ones I am trying to use are Moving Red Circle, Moving Red Rectangle, and Moving Exclamation Point.  The Green Ball items are from Cp5 Gallery.
    Thanks

    Ah...that explains why you would be seeing these icons.
    When Captivate's library opens, it goes through and checks the locations of the objects in the library to see if it still can connect to the source file locations.
    I would say the way to get around this would be to have the path to all source files replicated on each machine you work on.  So if you set up a C:/Projects directory with exactly the same folder structure on each PC you use, the path to source files should remain the same.  But I think trying to keep all the files in three machines always synced up will be more trouble than it's worth, personally.

  • Question about send/receive data in as3

    hello
    i want to ask : how can i send data from flash to php using as3 and receive data from php using flash .
    and another question : how can i upload files using as3 .
    thank you .

    Look into URLLoader documentation for sending/receiving and FileReference for uploading:
    http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/net/URLLoader.html
    http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/net/FileReference.html

  • URLRequest param set question

    i application URLRequest to post a new html page,which have
    some question for IE
    program:
    var url:URLRequest=new
    URLRequest("vodplay.html?name=22222");
    navigateToURL(url,"_self");
    when i apply ie to run this page,this param is null.
    when i app firefox to run this page ,this param is 22222.
    why it is so?

    They are individual ...

  • FlashBuilder and Flash AS3 question

    I'm heads down working with the FlashBuilder tool which is heavy AS3, and have used Flash CSx for years.
    My question: I'm assuming my AS3 skills that I develop with FlashBuilder will be directly applicable to Flash CSx, correct? I understand I'll need the context of applying my AS3 code to the Flash objects when working in Flash CSx but for the most part will my AS3 skills carry over from FlashBuilder to Flash CS4/5?
    Thanks in advance,
    Rich

    AS3 knowledge and skills has nothing to do with editors/IDE (which CSx, FlashBuilder, etc. are) per se. So, once you get your hands on AS3 - it doesn't matter where you write your code - it will work the same way in the final compiled swf. Nevertheless, there is a learning curve involved while getting to know new development environment as with any new software.

Maybe you are looking for

  • Java server faces submit button

    i'm running a java server faces example in tomcat.In that example i'm having a text field and a submit button, both are visible, but when i run the same example in JBoss app server the submit button is not visible ........whats the problem? Thanks in

  • XI vs BizTalk , WBI

    Hi, I am trying to convince my management to go with XI They want some comparison between the top competitors Does anyone have such a thing to share with me? [email protected] Thanks in advance,                   M

  • How about new IBAN s - Through ESS

    Dear Experts, We have provided ESS application for employees to maintain bank account details through portal logon ESS. But when employee enters new IBAN for him over the portal, it checks for existance of that IBAN in TIBAN table and as it is not th

  • Snmp to tftp config files

    I am trying to setup snmp to tftp the run/start config files. My test setup is using a 3745 with 12.4(25d) snmpset v1.01 from snmpsoft I think I am close but continue to get an error Here is the command I am using (line broken for clarity) snmpset -r

  • Archival Gold CD-Rs worth the cost?

    I was in a local photo shop yesterday and the owner was really hammering me about backing up my photos. I do quarterly backus to CD or DVD and I periodically copy my entire iPhoto library to an external drive. He recommended Archival Gold eFilm CD-Rs