Jump to content
Search Community

SudoPlz

Members
  • Posts

    21
  • Joined

  • Last visited

Posts posted by SudoPlz

  1. Also it seems like you are loading the same sound twice. Curious if loading unique sounds helps as your error and situation seems a little similar to this one: http://www.actionscripterrors.com/?p=522

     

    Hmm I changed that but still the same error.

     

    Here is a simplified version of my code :

    https://github.com/SudoPlz/testSoundLoadingLoadermax

     

    My plan is this:

    1) I load an XML which contains 2xMP3Loaders inside (with autoload=true),

    2) I want to prepend a url on Runtime before they get loaded, otherwise the mp3s are not to be found.

  2. Ok I found the recursivePrependURLs: property, and I ran my code again,

    xmlLoader.append(new XMLLoader(curTaleDirectory+"/"+XML_FILENAME, 
    {name:"taleName", 
    recursivePrependURLs:curTaleDirectory, 
    autoDispose :true }));

    but now I get this error:

    [trace] ---- 
    [trace] Error on MP3Loader 'aName' (assets/defaultTale/page_1/backsound.mp3):
    Error #2037: Functions called in incorrect sequence, or earlier call was unsuccessful.
    [trace] ----
    [trace] ----
    [trace] Error on MP3Loader 'anotherName' (assets/defaultTale/page_1/backsound.mp3):
    Error #2037: Functions called in incorrect sequence, or earlier call was unsuccessful.
    [trace] ----
    

    Hmm weird.. Am I doing something wrong, or is this a bug?

  3. I currently have an XML with MP3Loader inside.

     <LoaderMax name="ft$1:page$1" autoLoad="true">
          <MP3Loader name="aName" url="page_1/backsound.mp3" estimatedBytes="2050" autoPlay="false" />
          <MP3Loader name="anotherName" url="page_1/backsound.mp3" estimatedBytes="2050" autoPlay="false" />
     </LoaderMax>
    

    I want to have different prepended a url on each of the MP3Loaders, but using

    xmlLoader.prependURLs(aNewDirectoryPrepended,true); only prepends a Url in my XMLLoader and NOT on each Mp3Loader contained within the xml.

     

    I found that to be correct because of this:

     

    prependURLs() only affects loaders that are children of the LoaderMax when the method is called - it does not affect loaders that are inserted later.

     

     

    Please read the next post:

  4. I'm using this function to get the MP3Loaders from within the xml

     xmlLoader = new LoaderMax({name:"aName", autoDispose :true, onComplete:propsLoaded});
            xmlLoader.append(new XMLLoader(loaderPath, {name:"anotherName" , autoDispose :true,  estimatedBytes:841 }));
            xmlLoader.load();
    
    
    private function propsLoaded(e:LoaderEvent):void {
    
            var curPageLoader:LoaderMax = xmlLoader.getLoader("loaderrr"); //get the pages LoaderMax stored within the xml
            //curPageLoader is NOT null, but it contains NO loaders inside - it should containt 2 MP3Loaders according to my xml
    }
    
    <?xml version="1.0" encoding="utf-8"?>
    <tale id="1">
      <page id="1">
      <taleText>Lorem ipsum bla bla bla.</taleText>
          <LoaderMax name="loaderrr">
              <MP3Loader name="sth1" url="page_1/backsound.mp3" estimatedBytes="2050" autoPlay="false" />
              <MP3Loader name="sth2" url="page_1/backsound.mp3" estimatedBytes="2050" autoPlay="false" />
          </LoaderMax>
      </page>
    </tale>
    

    but the LoaderMax object that is returned to me has NO loaders inside. Its empty.. Why is that?

  5.  xmlLoader = new LoaderMax({name:"aName", autoDispose :true, onComplete:propsLoaded});
            xmlLoader.append(new XMLLoader(curTaleDirectory+ "/" +Constants.PROPS_XML_FILENAME, {name:"anotherName"+_taleId.toString() , autoDispose :true,  estimatedBytes:841 }));
            xmlLoader.load();
    
    
    private function propsLoaded(e:LoaderEvent):void {
    
            var objects:Array = e.currentTarget.content;
            var taleProps:XML = objects[0];     // This ONLY works on mobile devices..!
            //TODO: Why doesnt it recognise the WHOLE file?
            trace(taleProps); // prints this: <?xml version="1.0" encoding="utf-8"?> 
    }
    
    <?xml version="1.0" encoding="utf-8"?>
    <tale id="1">
      <page id="1">
        <taleText>
    Lorem ipsum bla bla
        </taleText>
        <LoaderMax name="ft$1:page$1">
          <MP3Loader name="ft$1:page$1:mc$1$always" url="page_1/backsound.mp3" estimatedBytes:"2050" autoPlay="false" />
          <MP3Loader name="ft$1:page$1:mc$1$onClick" url="page_1/backsound.mp3" estimatedBytes:"2050" autoPlay="false" />
        </LoaderMax>
      </page>
      <page id="2">
        
      </page>
      <page id="3">
       
      </page>
      <page id="4">
       
      </page>
      <page id="5">
       
      </page>
      
      <name>aName</name>
      <purchased>true</purchased>
      <pageCnt>20</pageCnt>
      <url></url>
    </tale>
    
    

    I'm using the code above to load the above xml file.. Instead of getting the whole file loaded, I only get the first line.. Why is that?

     

    Thank you.!

  6. Yes you are correct, no LoaderEvent.ERROR event dispatched for the disrupted internet  connection (after the download had started - but not finished).

     

    I specifically added each and every LoaderEvent, and then disconnected my device from the Internet to see what events will be dispatched.

    The only events that dispatched when i disrupted the connection where, http_status, and complete. No error event.

  7. I'm using Loadermax to load a remote binary file (zip).

     

    queue.append( new BinaryDataLoader(e.url,{/*name:"test_zip" , */ format:"binary", estimatedBytes:4400000})  );
    queue.addEventListener(LoaderEvent.COMPLETE, onDownloadComplete);
    queue.addEventListener( LoaderEvent.PROGRESS, onDownloadProgress);
    queue.load();
    

     

    I when its complete, i got my .COMPLETE event. but what about when the internet connection goes down? I got no handler for that case..

    I noticed i can use HTTP_STATUS, but it fires before complete as well during an error. How can I distinguish those 2 case senarios...

     

    Thank you.

  8. Thank you very much for your great helpful and kind response..

    This was the problem.. (Strangely I've been using auto-dispose :true all this time with no problems untill now. I mistakenly thought what it did was disposing all the queues and the loaded items AFTER the handler had run.

    I said it before and I'll say it again.. Your forums, your replies, and your code are GOLDEN each and every time. Thank you very much.

  9. Hello, I'm using the Loader as such..

    First im loading an xml file from a remote server.

     

     

    queue.append( new XMLLoader( Constants.SERVER_XML_FILENAME ,{estimatedBytes:2000}) );
    queue.addEventListener(LoaderEvent.COMPLETE, onXMLLoadComplete);
    queue.load();
    public function onXMLLoadComplete(ev:LoaderEvent):void
    {
     trace(ev.currentTarget.content.length)
    //length is 1
    }
    

     

    which is 1 indeed

     

    Right after this I load 3 remote images and 2 local sounds like so

     

     

     

     

    queue.empty(true,true)
    queue.addEventListener(LoaderEvent.COMPLETE, onSoundLoadComplete);
    
    queue.append(new MP3Loader( Constants.SOUNDS_PATH + "/move1.mp3" , {estimatedBytes:8594, repeat:0, autoPlay: false,autoDispose:true}));
    
    queue.append(new MP3Loader( Constants.SOUNDS_PATH + "/move2.mp3" , {estimatedBytes:8594, repeat:0, autoPlay: false,autoDispose:true}));
    
    
    
    queue.append( new ImageLoader( url1 , { estimatedBytes:1000000 , alpha:0, scaleMode:"proportionalInside",autoDispose:true}) );
    queue.append( new ImageLoader( url2 , { estimatedBytes:1000000 , alpha:0, scaleMode:"proportionalInside",autoDispose:true}) );
    queue.append( new ImageLoader( url3 , { estimatedBytes:1000000 , alpha:0, scaleMode:"proportionalInside",autoDispose:true}) );
    queue.load();
    
    
    public function onSoundLoadComplete(ev:LoaderEvent):void
    {
     trace(ev.currentTarget.content.length)
    //length should be 5 but is 1
    }
    

     

    which is 1 instead of 5...

     

    Also if I add event listeners for cancel,error, ioError, httpStatus etc, i get NO errors at all and the on error handlers never run.

     

    It is driving me nuts and I can't figure why it ONLY loads 1 out of the 5 assets I need. (It is an Image also, and not a sound which is the first asset)

    ..

    Help plz.

  10. Hello, I need this functionallity, but I can't seem to do it by using as3. I know this might not be the correct forum to ask such a question, but I'm using LoaderMax to load my local assets anyway, so people might be experienced in these forums and answer my question..

     

    What I want to do is download a few files (mp3, jpg, zip) from a remote address, and then save it right to the disk..

     

    After loading everything with loader max (from the web) I end up with files loaded in memory, which I want to save on the disk..

     

    var btAr:ByteArray = new ByteArray(); //initializing byte array
    var snd:Sound = new mp3sound(); //this is an embeeded mp3 file !
    snd.extract(btAr,int(mp3sound.length * 44.1) )  //extract the mp3 into a byte array
    btAr.position = 0;
    var str:String = File.applicationDirectory.nativePath;
    appTempData = new File(str +"/\.\./tmp");    //temp folder of an iOs app
    fr = new FileStream();
    try
    {
       fr.open(
        appTempData	 //  appTempData or appCache or appData or userDocs
        .resolvePath("myCache.mp3"),FileMode.WRITE);
       fr.writeBytes(btAr)
       fr.close();
    }
    catch(er:Error)
    {
       trace("ERROR: "+er);
    }
    

  11. Are you saying that the negative values go in the clockwise direction? Help me understand what exactly is happening for you that you need to fix.

     

    You can use relative values if you want - negative values will always travel counter-clockwise and positive values will go clockwise. To define a value as relative, you simply cast it as a String by either putting it in quotes or wrapping it with String(). You could use a function like this to convert an absolute value to a relative value based on the current rotation of an object:

    function getRotationchange(mc:DisplayObject, newRotation:Number, clockwise:Boolean):String {
    var dif:Number = newRotation - mc.rotation;
    if (Boolean(dif > 0) != clockwise) {
    dif += (clockwise) ? 360 : -360;
    }
    return String(dif);
    }

     

    Then you could use it with TweenLite/Max, like:

     

    var twM1:TweenMax = new TweenMax(myPointer, 5, {rotation:getRotationchange(myPointer, 180, true), ease:Linear.easeNone});

     

     

    THANK you ..! You solved my question too..! You are ALWAYS right on target.. Thanks for sharing... !!!

  12. I would like to get my target and access its properties (while tweening).

    I tried onUpdate func etc, but I can't seem to get the target out of the event.

    Se below to understand what im talking about.

     

    tileMovement.insert( TweenLite.to(target, 1, {y:-(tileHeight*2), scale:2, ease:Elastic.easeIn, onUpdate: deebreeStart})
    for (var x:uint =0 ; x< 3; x++){
    deebree = particles.createDeebreeParticlesAt( target.x , target.y );
    deebree.start(1);
    }
    

     

     

    function deebreeStart(evt:TweenEvent):void {
    
     trace( evt.target.x);
    
    }
    

    This results on

    ArgumentError: Error #1063: Argument count mismatch on Function/deebreeStart(). Expected 1, got 0.

     

     

     

    To tell the whole story, I wan't to get some particles to follow a few tiles while they are moving. That why I need to access the tiles properties.

    Any suggestions?

×
×
  • Create New...