Jump to content
Search Community

Mr Pablo

Members
  • Posts

    132
  • Joined

  • Last visited

Everything posted by Mr Pablo

  1. I'm looking to make my Flex Mobile app nice and flexible (geddit?) and I'm working on the scaling to allow it to run on both high and low DPI devices. I've set the application DPI to 160 (the lowest) and in my XML Loader document, I have specified SWF and Video files that are 1280x720 and I've set the scaleMode to "proportionalInside". Testing in the Flex Android emulator set to low DPI device (1280x672, 160dpi) things looks pretty good. However, testing on a high DPI device (1280x720, 320dpi) my SWF files are not scaling to fit inside the display. Should they not shrink to fit inside the display? Is there any kind of DPI setting for LoaderMax?
  2. http://www.jumpeyecomponents.com/ If a use SWFs without the Movie Clip Transition Effects, yes, they load OK. TBH I've had issues with MCTE before (adding SWFs into and array don't work properly for example) Whats odd i that I can play SWF (with MCTE) > SWF > Image > Video and then back to the first SWF fine. But If I load the image before the SWF with MCTE, it breaks.
  3. Hmm I seemed to have fixed it, by accident. I was using the following code inside a function, to determine if the loader was a SWFLoader and do appropriate actions: if(currentAsset is SWFLoader){ trace("SWFLoader detected"); currentAsset.rawContent.gotoAndPlay(2); addEventListener(Event.ENTER_FRAME, trackSWFPlayback); addElement(currentAsset.content); } Now, I moved the " addElement(currentAsset.content);" up, above the "currentAsset.rawContent.gotoAndPlay(2);" statement (no idea why, i just did) and it now works. Very odd indeed! Now I need to figure out why certain ordering of loaders in my XML don't want to work (i started another thread for it)
  4. Using an XMLLoader, I have a few SWF files that loop one after the other. I am using: currentAsset.rawContent.gotoAndPlay(2); To start the SWF and using an eventListener: currentAsset.rawContent.stop(); To stop the SWF when the current frame equals the total number of frames. SWF 1 plays through its timeline, 480 frames, with various pieces of text showing up at different intervals on the timeline ie not scripted. After SWF 2 plays and SWF 1 is told to gotoAndPlay(2) again, the SWF displays, but as if it was at the end of its timeline, showing all the text without there timeline based tweens etc. I have looked and looked and cannot find an answer for this. Lots of chatter about load() and unload() but I simply cannot make them work for me. I tried: currentAsset.unload(); currentAsset.load(): but I got errors. Where and how should I use load/unload(), bearing in mind I am using XMLLoader to load SWFLoaders. Why isn't gotoAndPlay(2) working properly? I have a listener to display the frame count and it always counts up properly, despite showing all the text at once as if they were there in the beginning. Really need to sort this as its a major issue for me that needs to be fixed and work flawlessly. Cheers
  5. When lopoing through an XMLLoader with SWF assets, the previously played SWFs are not starting from the beginning, despite the following code: if(currentAsset is SWFLoader){ trace("SWFLoader detected"); currentAsset.rawContent.gotoAndPlay(2); addEventListener(Event.ENTER_FRAME, trackSWFPlayback); addElement(currentAsset.content); } Seems like the gotoAndPlay command isn't working? The event listener "trackSWFPlayback" is as follows: private function trackSWFPlayback(e:Event):void { if (currentAsset.rawContent.currentFrame == currentAsset.rawContent.totalFrames) { currentAsset.rawContent.stop(); removeEventListener(Event.ENTER_FRAME, trackSWFPlayback); getNextAssetIndex(); } } Any idea whats going on?
  6. I am trying to display an image, then a SWF file. It works if I display a SWF then an image. I get the following error when a SWF follows an image: My SWF file is using Movie Transitions for some effects (again, it works perfectly if i display the SWF then an image) Here is my code to display the assets: public function showAsset(index:int):void { dynamicLoad = LoaderMax.getLoader("dynamicLoaderMax"); currentAsset = dynamicLoad.getChildAt(index); var vars:XML = currentAsset.vars.rawXML; if(vars.params.time) { time = vars.params.time; } if(currentAsset is DataLoader){ trace("DataLoader detected"); webView.stage = this.stage; webView.viewPort = new Rectangle( 0, 0, stage.width, stage.height ); webView.loadURL(currentAsset.url); TweenLite.delayedCall(time, getNextAssetIndex); } if(currentAsset is ImageLoader){ trace("ImageLoader detected"); addElement(currentAsset.content); TweenLite.delayedCall(time, getNextAssetIndex); } if(currentAsset is VideoLoader){ trace("VideoLoader detected"); currentAsset.gotoVideoTime(0, true); currentAsset.addEventListener(VideoLoader.VIDEO_COMPLETE, onVideoComplete); addElement(currentAsset.content); } if(currentAsset is SWFLoader){ trace("SWFLoader detected"); currentAsset.rawContent.gotoAndPlay(2); addEventListener(Event.ENTER_FRAME, trackSWFPlayback); addElement(currentAsset.content); } } Here are the functions to handle playing the next asset in the XML loader private function trackSWFPlayback(e:Event):void { trace(currentAsset.rawContent.currentFrame); if (currentAsset.rawContent.currentFrame == currentAsset.rawContent.totalFrames) { trace("swf done"); currentAsset.rawContent.stop(); removeEventListener(Event.ENTER_FRAME, trackSWFPlayback); getNextAssetIndex(); } } public function onVideoComplete(e:LoaderEvent):void { trace("Video finished"); removeEventListener(VideoLoader.VIDEO_COMPLETE, onVideoComplete); getNextAssetIndex(); } public function getNextAssetIndex():void { if(webView.stage) { webView.viewPort = null; } else { removeElement(currentAsset.content); } if(currentIndex == dynamicLoad.getChildren().length - 1) { currentIndex = 0; } else { currentIndex++; } showAsset(currentIndex); } I think it may be how I'm hiding/removing the current asset from view when the next one is loaded, but I have no idea. Really odd that it works when its SWF -> Image. Any ideas folks? EDIT - even weirder, SWF > Image > SWF gives the same error. SWF > SWF > Image works.
  7. I'm trying to implement option 2 as you described, but I cannot seem to get anywhere. I have my XML doc, and I've made it so only 1 out of a few assets will actually load (basically, I deleted the other asset files in the folder) Here is my code to try and get some kind of output in the console: Handler for when the XMLLoader completes: public function completeHandler(e:LoaderEvent):void { traceChildren( LoaderMax.getLoader(xmlLoad.name + "_ParsedLoaders") ); } "xmlLoad" is the XMLLoader traceChildren function (to hopefully output some info to console to show the one asset is complete and OK to use: function traceChildren(queue:LoaderMax):void { var test:Array = queue.getChildrenByStatus(LoaderStatus.COMPLETED); trace(test); } Console output: LoaderMax 'dynamicLoaderMax' "dynamicLoader" is the name of the loadermax node in my XML doc. Shouldn't I be seeing an array with the one complete asset in it? Or is that LoaderMax reference a new loader that I can reference directly? How would I reference it to make sure I only tried to access complete assets?
  8. Apologies, was rushed for time earlier. If I define the file path in the XML document, it works. I used prependURLs in the same scenario and it failed. When I set load to true AND use prependURLs, thats when it broke.. I have converted the project to Flex, but the AS3 code is what matters. I will try and sort out some files to upload for you.
  9. It broke when I set the "load='false'" option in my XML document, tor "true"
  10. I am wanting to pass along URL parameters inside my XML document to the SWF assets I am loading. Here is the code I am using: XML document <data> <LoaderMax name="dynamicLoaderMax" load="true" scaleMode="stretch"> <SwfLoader name="test" url="test.swf?ct1=testing" autoPlay="false" /> </LoaderMax> </data> Inside test.swf, frame 2 (frame 1 is "stop();") import flash.events.Event; Security.allowDomain("*"); Security.allowInsecureDomain("*"); var loaderParams:Object = new Object(); addEventListener(Event.ADDED_TO_STAGE, getParams); function getParams(e:Event):void{ loaderParams = LoaderInfo(this.root.loaderInfo).parameters; } var text1:String = loaderParams.ct1; var text2:String = loaderParams.ct2; var text3:String = loaderParams.ct3; var text4:String = loaderParams.ct4; I also tried: import flash.events.Event; addEventListener(Event.ADDED_TO_STAGE, getParams); function getParams(e:Event):void{ var loaderParams:Object = this.loaderInfo.parameters; } Nothing works for me. Tried adding in traces inside the SWF, I get "undefined" Really need to be able to pass variables along to my SWFs! EDIT - Just to note, despite previous posts, I am now using LoaderMax inside a Flex Mobile application, thought I'm sure this shouldn't affect anything?
  11. I used your traceChildren function and I got the correct file locations (I had to apprend the path with "\\foldername\\") If i copy and paste the console output into Windows Explorer, it takes me to the correct file. But If i set load="true" in my XML, it still breaks. Definitely a bug somewhere in LoaderMax?
  12. public function completeHandler(e:LoaderEvent):void { trace("assets loaded"); var loaders:Array = LoaderMax.getLoader(xmlLoad.name + "_ParsedLoaders").getChildren(); for (var i:int = 0; i < loaders.length; i++) { trace(loaders[i].url); } } gave the following error: :/
  13. Sorry, but I'm not sure where to add in the code you supplied. Do I put it in an event handler? use just underneath my XML Loader? I set load="true" to false. Do I comment out "xmlLoad.load();"? Sorry for being a noob!
  14. I'm guessing it's my implementation that is to blame, due to not knowing the ins and outs of LoaderMax Currently, I have a working XML Loader that reads my XML doc (which contains 3 assets, 1 SWf and 2 videos) After the XML Loader has completed loading the assets, my completeHandler runs a function to display the first asset in the list. Here is the function: public function showAsset(index:int):void { dynamicLoad = LoaderMax.getLoader("dynamicLoaderMax"); currentAsset = dynamicLoad.getChildAt(index); trace(dynamicLoad.getChildren().length); //var currentAsset = xmlLoad.getContent("dynamicLoaderMax"); trace("currentAsset = " + currentAsset); //detect what type of asset needs to be shown and played if(currentAsset is ImageLoader){ trace("ImageLoader detected"); } if(currentAsset is VideoLoader){ trace("VideoLoader detected"); currentAsset.gotoVideoTime(0, true); currentAsset.addEventListener(VideoLoader.VIDEO_COMPLETE, onVideoComplete); } if(currentAsset is SWFLoader){ trace("SWFLoader detected"); currentAsset.content.visible = true; currentAsset.rawContent.gotoAndPlay(2); addEventListener(Event.ENTER_FRAME, trackSWFPlayback); } addElement(currentAsset.content); } As you can see, I am using the XML document itself as a reference to the assets (this is so I can play them in a loop - see my previous posts) So the issue is arising because if asset 1 fails to load in the XML Loader, and I am trying to play it with my function shown above, I get problems. How can else can I get a reference to the assets in order to play the first one (that has loaded successfully) and loop them?
  15. I actaully tried both url and nativePath, as well as userDirectory and documentsDirectory. Neither combinations worked with prependURLs. I got my rawLoad Handler working to edit the URL in the XML and it works perfectly. I have another issue now which I posted in a new thread The fun never ends haha!
  16. How can I go about removing failed loaders from my XML Loader? E.g. I have an xml doc defining a SWF, then 2 videos. If, for example, the SWF fails to load for what ever reason, how can I remove it from the XML Loader list? Currently, if an asset fails to load e.g. incorrect path, the XML Loader still tries to load the asset into the container. I know there is an "onChildFail" event, but I cannot see anything about removing the failed child loader from the main loader?
  17. Ok,I was able to use: private function onCreation(e:Event):void { LoaderMax.contentDisplayClass = FlexContentDisplay; LoaderMax.activate([ImageLoader]); var path:String = File.userDirectory.nativePath; var image:ImageLoader = new ImageLoader(path + "/" + "IMG_4684.JPG", {container:this}) image.load() } And the image loaded. Note I did have to insert the forward slash, but even so, thats a simple thing to correct at any point. I'm thinking it may because I was assigning the userDirectory to a variable outside of the creation function? However, I was testing again with my XMLLoader, putting a variable assigned to the file path as the prependURLs option, the application simply freezes with no error in the console. Why would imageloader work (even if the path is wrong, eg take away the additional slash, it shows a loadermax error) and xmlloader won't? Very odd! EDIT - I am able to use the following URL inside my XML document: file:///C:/Users/MyUserName/FolderName/SwfFile.swf And this loaded fine. So there is clearly an issue with prependURLs as it does not work when I set prependURLS to "file:///C:/Users/MyUserName/FolderName/" !! Is there a way to prepend/modify the URLs in the XML without the loader option?
  18. Global.storagePath = File.userDirectory.url; private var path:String = Global.storagePath; private function onCreation(e:Event):void { LoaderMax.contentDisplayClass = FlexContentDisplay; LoaderMax.activate([ImageLoader, SWFLoader, VideoLoader]); xmlLoad = new XMLLoader("xml.xml", {name:"xmlDoc", onComplete:completeHandler, onError:errorHandler, prependURLs:path}); xmlLoad.load(); }
  19. File.userDirectory does have a url property! It was tracing out: But assigning that to a variable and passing it to prependURLs in the XMLLoader froze the application!? EDIT - running it via Debug doesn't show me the problem, but the Profiler does. I get this error: Just to add to this, when I run it via Debug, I don;t even get the errorHandler messages being traced, it simply locks up before hitting those. Clearly it doesn't like the string being passed?
  20. Zync - File.userDirectory. native path returns a string, I can trace it out to console. Carl - I am able to use nativePath in my Flash version of this project where I am writing out the Loaders myself. I'll try and load a single asset with it and see what happens. Surely LoaderMax should be able to cater for this?
  21. Building a Flex Mobile app for Android. I am using LoaderMax to load assets held on local disk (not a remote server). In my XML file, I have the file names as the URL, but I need to use the prependURLs parameter to pass in the File.userDirectory.nativepath (which on Windows, points to C:\Users\Username and on Android, points to the sd card) Even though File.userDirectory.nativePath returns a string, it breaks the loader if i use it as the prependURLs parameter. How can I point the Loader to the correct directory? Currently, my assets to be loaded have to sit inside the applications "src" folder - not ideal or practical for my actual needs!
  22. It was never firing. I fixed it by changing it from: currentAsset.addEventListener(Event.ENTER_FRAME, foo); to addEventListener(Event.ENTER_FRAME, foo); But the Video listener had to keep the currentAsset variable. Weird!? I have some new issues now, but I will create a new post for those
  23. Thank you, very informative! I've got another small problem, my SWF files are looping, and not stopping with my event listener! I have: public function trackSWFPlayback(e:Event):void { if (currentAsset.rawContent.currentFrame == currentAsset.rawContent.totalFrames) { trace("swf done"); //hide and stop current swf currentAsset.content.visible = false; currentAsset.rawContent.stop(); //set up and play the next swf getNextAssetIndex(); } } Initialised by: if(currentAsset is SWFLoader){ trace("SWFLoader detected"); currentAsset.rawContent.gotoAndPlay(2); currentAsset.addEventListener(Event.ENTER_FRAME, trackSWFPlayback); } But it never fires. I have a video play, then this SWF, and another video should play after. the VIDEO_COMPLETE listener works perfect, but this method for stopping the SWF doesn't work oddly! Any reason you can think why it wouldn't work?
  24. Super, thanks! My project is running really well, and error free (obv, it couldn't compile otherwise!) but I do have 1 warning. I am declaring: private var dynamicLoad:LoaderMax; private var currentAsset; For the following: dynamicLoad = LoaderMax.getLoader("dynamicLoaderMax"); currentAsset = dynamicLoad.getChildAt(index); The warning is about currentAsset not being type-cast. But I simply don't know what it is haha! I tried it as a LoaderItem, but it didn't like that at all! I even tried FlexContentDisplay, but no dice. Do you know what it should be declared as?
×
×
  • Create New...