Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...

Search the Community

Showing results for tags 'xmlloader'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • GreenSock Forums
    • GSAP
    • Banner Animation
    • Jobs & Freelance
  • Flash / ActionScript Archive
    • GSAP (Flash)
    • Loading (Flash)
    • TransformManager (Flash)

Product Groups

  • Club GreenSock
  • TransformManager
  • Supercharge

Categories

There are no results to display.


Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Personal Website


Twitter


CodePen


Company Website


Location


Interests

Found 16 results

  1. My group of coders build/deploy flash games to several different sites, and it's usually fairly straightforward. One of these sites used to have a flash-based container that would load in our games, and it worked fine. But the people on that team who knew AS3 left, so they made a new container that is primarily javascript, with a thin AS3 shim to load in the games. This works fine for debug builds, but things slow down to a crawl when we try release builds (load times go from 30 seconds or so to over ten minutes). Their old container doesn't have an issue with release builds. This week was our company's hackathon, so I decided to delve into this and see what I could find. We do our game asset loading using XMLLoader to load in a couple xmls (one at a time) that have MP3Loaders and SWFLoaders in them. The behavior I was seeing in the release builds was that it would load the xml, wait about 90 seconds, then audit the child loaders for size, wait another 90 seconds or so, then load in the children, sometimes taking breaks between children. Prior to this week, none of them had estimatedBytes vars in the loader definitions in the xml. So, I added estimatedBytes to the first file that just had a MP3Loader wrapped in a LoaderMax block, and it zipped right along, leading me to believe that I'd found at least a way to fix things. But adding estimatedBytes to the second xml where all the children were individual SWFLoaders didn't reduce the lag with the second file at all. I tried updating the greensock swc on the games side (we had a version from late 2013), and besides requiring some very minimal refactoring based on changes in the api, that didn't appear to help the issue either. I also tried upping the maxConnections for the second XMLLoader, grouping all the SWFLoaders into a single LoaderMax bundle, and turning off the integrateProcess flag for the SWFLoaders (though this may or may not have been done in the right place, will probably try adding this to the xml lines next), but all to no avail. As these are very large projects, copying and pasting snippets seems unproductive, but I'm just wondering if you have any other ideas I should be trying. I know the JS layer is using greensock for something, but after sifting through the codebase for it, nothing jumped out at me as even remotely related. Any of this sound even remotely familiar to something you've run across?
  2. 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?
  3. 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.!
  4. Hello! Is it possible to load objects outside the "complete" events ( LoaderEvent )? Right now, it's like this: function initLoader():void { xmlLoader = new XMLLoader( "PathToXml/xml.xml", { onComplete:loadData } ); xmlLoader.load(); } function loadData( e:LoaderEvent ):void { loaderMax = LoaderMax.getLoader( "loaderID" ); loaderMax.addEventListener( LoaderEvent.COMPLETE, completeLoader ); loaderMax.load(); } function completeLoader( e:LoaderMax ):void { texture1 = TextureFromBitmapData( LoaderMax.getLoader( "image1" ).rawContent.bitmapData ); texture2 = TextureFromBitmapData( LoaderMax.getLoader( "image2" ).rawContent.bitmapData ); texture3 = TextureFromBitmapData( LoaderMax.getLoader( "image3" ).rawContent.bitmapData ); (...) } And it works, but I have to write this in every class of my app, not handy if I have to change something... That's why I wanted to create a "LoaderScreen" class, that I call where I need, with some methods to help me to handle all the assets / loaders. More or less like this: class LoaderScreen public function LoaderScreen( loaderId:String ) { xmlLoader = new XMLLoader( "xml", { onComplete:loadData } ); xmlLoader.load(); } private function loadData( e:LoaderEvent ):void { loaderMax = LoaderMax.getLoader( loaderID ); loaderMax.addEventListener( LoaderEvent.COMPLETE, completeLoader ); loaderMax.load(); } private function completeLoader( e:LoaderEvent ):void { // nothing here } // HELPERS -- public function loadBitmapdata( id:String ):BitmapData { return mainLoader.getLoader( "texParticleMenuHome" ).rawContent.bitmapData; } And now I want to create a LoaderScreen object, and try to load stuff: class Anywhere public class Anywhere() { var loaderScreen:LoaderScreen = new LoaderScreen( "myID" ); addChild( loaderScreen ); texture1 = TextureFromBitmapData( loaderScreen.loadImage( "image1" ) ); texture2 = TextureFromBitmapData( loaderScreen.loadImage( "image2" ) ); texture3 = TextureFromBitmapData( loaderScreen.loadImage( "image3" ) ); } But it returns "null" when I'm not in the "complete" event handler ( LoaderEvent ). trace( mainLoader.getLoader( "xxx" ) ) in the complete event return something trace( mainLoader.getLoader( "xxx" ) ) outside, return null It's a kind of "AssetsManager" I guess ( based on my framework ) but I only need to know how I can load stuff outside the LoaderEvent. If anyone can help me, or have a suggestion...! Thanks!
  5. I'm trying to check for the existence of an XML file — I'm doing this by doing a bogus load and returning the value of success or failure, thus: public static function RFIDExists($func:Function):void { var filename:String = RFID_READ_FILE; TTUtils.trc(7,"RFIDExists $func", $func); var loader:XMLLoader = new XMLLoader(SERVER_PATH + filename, {onComplete:function() {$func(true)},onIOError:function() {$func(false)}}); loader.load(); } Where $func is a function that will be called and take action based on the result. It works perfectly. My question is that the IDE keeps reporting errors such as Error on XMLLoader 'loader9' (http://localhost/tt/xml/scan.xml): Error #2032: Stream Error. URL: http://localhost/tt/xml/scan.xml Which is understandable, of course, but I don't want the program to 'crash' because I'm trying to load a file that isn't there. Is there a way to 'trap' this error so that it basically disappears? Is there another way (outside of AIR) to check for a file existence than this?
  6. I've been using XMLLoader to write XML files via a php script: private static function sendXML($xml:XML):void { // declaring var xmlcontents String. You should set this first. var xmlcontents:String = $xml.toString(); // declaring var SERVER_PATH String. This is the path for the saving-xml.php. var SERVER_PATH:String = TTConstants.SERVER_PATH + "/php/"; // declaring var foldername String. This is the folder container of the saved XML file var foldername:String = "../xml"; // declaring var dataPass URLVariables var dataPass:URLVariables = new URLVariables(); var previewRequest:URLRequest = new URLRequest(TTConstants.SERVER_PATH + "/php/ttwrite.php"); previewRequest.method = URLRequestMethod.POST; // setting dataPass variables to be passed to PHP dataPass.filename = USER_XML_FILENAME; dataPass.xmlcontents = xmlcontents; dataPass.foldername = foldername; // passing dataPass data PHP previewRequest.data = dataPass; var loader:XMLLoader = new XMLLoader(previewRequest, {onComplete:serverSendComplete,onIOError:onIOError,onSecurityError:onSecError,onError:onError}); // calling the PHP or loading the PHP loader.load(); } I want to call a PHP script to simply delete ("unlink") an xml file on the server. Can I use XMLLoader to do this as well (for ease of complete and error functions -- callbacks instead of adding/removing event listeners)? There's no XML loading involved, so I don't know if it's 'kosher' - var deleteRequest:URLRequest = new URLRequest("http://localhost/tt/php/ttdelete.php"); deleteRequest.method = URLRequestMethod.POST; var loader:XMLLoader = new XMLLoader(deleteRequest, {onComplete:serverDeleteComplete,onIOError:onIOError,onSecurityError:onSecError,onError:onError}); // calling the PHP or loading the PHP loader.load();
  7. I am trying to upload some graphic assets using XMLLoader and have noticed an unusual behavior concerning the estimatedBytes property. The XML file xml/assets2.xml does contain the estimatedBytes declared for all the xml childs and xml/assets.xml does not. Everything works fine if estimatedBytes is explicit declared, but if I omit it, the preloader bar jumps ahead. Shouldn't work just fine for both cases? Am I doing something wrong? I have uploaded the files so you can take a look. Desktop.zip Edit: I am testing with Flash CS6(simulate download)
  8. hi, thank you for this great and useful tool. my xml: <data> <ImageLoader name="digital_01" url="imgs/digital_01.jpg" centerRegistration="true" width="640" height="400" twx="342" twy="391" kw="230" kh="200" load="true"/> <ImageLoader name="digital_02" url="imgs/digital_02.jpg" centerRegistration="true" width="734" height="400" twx="594" twy="389" kw="215" kh="192" load="true"/> </data> as3: var queue_xml:XMLLoader = new XMLLoader("imgs/digitals.xml", {name:"digitalsXML", maxConnections:1, estimatedBytes:5000, onChildComplete:imageCompleteHandler, onComplete:queueCompleteHandler}); queue_xml.load(); var img_xml:XML = new XML; function imageCompleteHandler(event:LoaderEvent):void { addChild(event.target.content as ContentDisplay); img_xml = LoaderMax.getLoader(event.target.name).vars.rawXML; //i want to scale down images for using them as thumbnails too TweenMax.to(event.target.content, 0, {autoAlpha:0.2, blurFilter:{blurX:5, blurY:5}, width:img_xml.@kw, height:img_xml.@kh, x:img_xml.@twx, y:img_xml.@twy}); trace("original image value:"+ img_xml.@width +", xml thumbnail size(kw) value:"+ img_xml.@kw +", current image value:"+ event.target.content.width); // trace result for first //original image value:640, xml thumbnail size(kw) value:230, current image value:820 //trace result for second //original image value:734, xml thumbnail size(kw) value:215, current image value:1095 } function queueCompleteHandler(event:LoaderEvent):void { } problem: my images bigger than its actual size but i want them smaller. when i set kw or kh to negative values, result is what i want. btw this is my first project with greensock tools.
  9. I'm creating this xml file using PHP. When I setup php to echo the follow. Her is my issue. This doesnt work: <data> <LoaderMax name="queue" prependURLs="Images/" childrenVars="width:700,height:630,scaleMode:proportionalInside" alpha="0" load="true"> <ImageLoader name="Company Logo" url="Bed_bath_and_Beyond.png" estimatedBytes="31641" width="750" height="275"/> <ImageLoader name="Image" url="T-shirt.jpg" estimatedBytes="8611" Item_Id="1" Title="Men T-Shirts" Quick_Desc="Starting at $14.99 each..." Savings_amt="65% off"/> <ImageLoader name="Image" url="T-shirt.jpg" estimatedBytes="8611" Item_Id="3" Title="Women T-Shirts" Quick_Desc="Starting at $30.11 each..." Savings_amt="20% off"/> </LoaderMax> </data> --- onChildComplete:imageCompleteHandler public function imageCompleteHandler(event:LoaderEvent):void { trace(event.target.content); var loadedImage:ContentDisplay = event.target.content as ContentDisplay; //you must manually add the loadedImage to the display list addChild(loadedImage); TweenLite.to(loadedImage, 1, {alpha:1}); } What is being traced: [object ContentDisplay] [object ContentDisplay] [object ContentDisplay] [object ContentDisplay],[object ContentDisplay],[object ContentDisplay] I only have 3 images so I understand this: [object ContentDisplay] [object ContentDisplay] [object ContentDisplay] Why am I getting this: [object ContentDisplay],[object ContentDisplay],[object ContentDisplay] This works: <data> <ImageLoader name="Company Logo" url="Images/Bed_bath_and_Beyond.png" estimatedBytes="31641" width="750" height="275" scaleMode="proportionalInside" alpha="0" load="true"/> <ImageLoader name="Image" url="Images/T-shirt.jpg" estimatedBytes="8611" Item_Id="1" Title="Men T-Shirts" Quick_Desc="Starting at $14.99 each..." Savings_amt="65% off" width="700" height="630" scaleMode="proportionalInside" alpha="0"load="true"/> <ImageLoader name="Image" url="Images/T-shirt.jpg" estimatedBytes="8611" Item_Id="3" Title="Women T-Shirts" Quick_Desc="Starting at $30.11 each..." Savings_amt="20% off" width="700" height="630" scaleMode="proportionalInside" alpha="0"load="true"/> </data> Everything loads fine when I do it this way. Any suggestions?
  10. Hi, (first of all, sorry I posted a reply instead of creating new topic before, newby) I have a Loadermax with multiple loaders (image, xml, video and selfloader). All them have estimatedBytes and autodispose = false. I also have progress, complete and onError handlers set up. Testing for errors, I get the complete event fired before the onError event...... the onError handler would have a boolean to let the whole thing to start or not. so, why does the onComplete fires before the onError? Thanks Al
  11. When nesting loaders in an XMLLoader, I can use prependURLs to modify the location in which the assets are loaded. Unfortunately, if "../" was part of the URL path, the result is an invalid path. // example: inside data/assets.xml <SoundLoader url="../shared/sound1.mp3"> w/ prependURLs "http://foo.com/game/", this becomes: "http://foo.com/game/../shared/sound1.mp3" when it should be: "http://foo.com/shared/sound1.mp3" I was able to resolve this issue with an update to the LoaderMax.prependURLs method: public function prependURLs(prependText:String, includeNested:Boolean=false):void { var loaders:Array = getChildren(includeNested, true); var i:int = loaders.length; while (--i > -1) { LoaderItem(loaders[i]).url = validatePath(prependText + LoaderItem(loaders[i]).url); } } protected function validatePath(path:String):String { var i:int, j:int; do { i = path.indexOf("../"); if (i > -1) { j = path.lastIndexOf("/", i - 2); if (j > -1) path = path.substr(0, j + 1) + path.substr(i + 3); } }while (i > -1 && j > -1) return path; }
  12. I have an XMLLoader which loads an XML containing 2 LoaderMax objects, one with load="true" and one with load="false". When the XMLLoader triggers onComplete, I start my app and want to request the second LoaderMax to start. When I do this, however, the assets never seem to start loading. Am I calling things correctly? // XML <GameAssets> <LoaderMax name="Subload" load="false" childrenVars="autoPlay:false"> <VideoLoader url="videos/Main/M1.f4v" name="M1MainAnimation" autoDispose="false" /> </LoaderMax> </GameAssets> // AS3 private function _onLoadComplete(e:LoaderEvent):void { trace("ASSETS LOADED"); var subLoader:LoaderMax = LoaderMax.getLoader("Subload"); subLoader.vars = { onProgress:onSubloadProgress } subLoader.load(); } private function onSubloadProgress(e:LoaderEvent):void { trace("THIS NEVER HAPPENS?"); }
  13. I can't figure something out. I am trying to: Simply stated, I have loaded an XML doc. Changed it within Flash. I then want to update the XML doc on the server. Then reload the XML back into Flash. I have one main .xml document - "StudentXML.xml" (This is the file I want to overwrite with new info - it is also the file I read from with the application begins.) And one main .php document - "index.php" (sorry for my crappy naming standards..) Here is the PHP code I found (hoping it would do what I wanted) located in "index.php": <?php $filename = "StudentXML.xml"; $raw_xml = file_get_contents("php://input"); print $raw_xml; $fp = fopen($filename, "w"); fwrite($fp, $raw_xml); fclose($fp); ?> Here is my data I want to change and see transfered to the server to overwrite the current XML Document. At this point, I have already loaded, accessed, and read my StudentXML.xml within Flash. var newLogin:XML = <badge>eStudioLogin</badge>; studentXML.id.(@number == studentID.toString()).allBadgeNames.prependChild(newLogin); studentXML.id.(@number == studentID.toString()).badgesEarned = int(studentXML.id.(@number == studentID.toString()).badgesEarned) + 1; So far, and this is not working, I have pieced together this lovely bit of code: var requested:URLRequest = new URLRequest("www.mysite.com/index.php"); requested.data = studentXML; // This does trace the entire [i]edited[/i] XML document that is in Flash requested.method = URLRequestMethod.POST; var loader:XMLLoader = new XMLLoader(requested,{name:"StudentXML",onProgress:showProgress}); loader.load(); I know I am being dumb. It can't be this hard to transfer data and overwrite an existing xml document. Any help would truly be appreciated. Thanks, Adam
  14. Hi, I am trying to load some images from xml with LoaderMax. When the LoaderMax finish his images loading he try to load himself, In the childComplete function I use the rawContent, but when the LoaderMax try to load his own instance I get an error says that loaderMax don't have rawContent. To bypass it I use this if statement if (event.target !="LoaderMax 'loaderMaxName'") I am sure there is better way to bypass it, What can I do? Thanks, DingoMan
  15. Hello GreenSock! Congrats for your Amazing job. I’m really a first timer with AS3, Greensock and have no skills with programming. I just made a huge personal flash website and I was stacked with the LoaderMax and XMLLoader. Never made it work. (Need a lot of studying) But this tutorial helps me like a charm: (thanks to Carl) http://www.snorkl.tv...-the-xmlloader/ From the XML file, I load with succeed, the Main swf plus 200 swf files. Main swf loaded at x:0 y:0 and all other swf files at x:3000 and y:3000 Just far away from the stage. Everything load and work ok, but Loading 200 files on the stage makes fps to 2-5/sec How can I remove all loaded swf from the stage, except from the Main swf ??? I use the same actionscript and xml from Carl's tutorial.! Thanks Sakar
  16. I'm porting an existing flash framework for an online course that previously had all of the assets hard coded in AS3 over to LoaderMax. I'm planning to externalize all references to the media assets (video, swf) along with course settings to a single XML and load with LoaderMax. The XML file also contains cuepoints for each node that trigger timeline labels using TimeLineMax when a videocuepoint is reached. I've done some testing using addASCuePoint with VideoLoader. Looking for suggestions on the structure of the XML so that it best supports the LoaderMax platform. Is it better to add the SWF reference as an inline attribute with the video parameters or as a node - allowing it to have its own parameters? Here is the XML I have so far: <videoList> <coursename>Course 1</coursename> <introAnim>intro</introAnim> <settingAutoPlay>1</settingAutoPlay> <settingLMS>1</settingLMS> <LoaderMax name="videoListLoader" maxConnections="1" prependURLs="assets/"> <VideoLoader name="segment1" url="video1.mp4" height ="370" width="278" scaleMode="none" centerRegistration="true" alpha="0" autoPlay="false" volume=".5" swf="swf1"/> <swffile>swf1</swffile> <cuepoints> <cuepoint> <name>introduction</name> <time>0</time> <label>Introduction XX</label> <caption>intro caption</caption> </cuepoint> <cuepoint> <name>idea_1</name> <time>3.042</time> <label>Idea 1</label> <caption></caption> </cuepoint> <cuepoint> <name>closing</name> <time>12.601</time> <label>Closing</label> <caption>Closing caption</caption> </cuepoint> </cuepoints> <VideoLoader name="segment2" url="video2.mp4" height ="370" width="278" scaleMode="none" centerRegistration="true" alpha="0" autoPlay="false" swf="swf2"/> <swffile>swf2</swffile> <cuepoints> </cuepoints> </LoaderMax> </videoList> How are the Video & SWF files then loaded simultaneously with LoaderMax? Would it be better to load each video/swf/cuepoint node on demand (using getChildAt())? There is roughly 50mb of combined video files and swf's in the course with each segment around 2-3mb. I'm really excited about the elegant combination of LoaderMax & Tween/TimelineMax, but I'm having difficulty putting it all together.
×