Jump to content
Search Community

alflasy

Members
  • Posts

    72
  • Joined

  • Last visited

alflasy's Achievements

1

Reputation

  1. Hi, I am something really weird going on. I am loading an images from xml file and there is one large image in xml that is loaded only when the user click a button. So I am using getContent and get Loader to get image and then display.The weird this is that it doesn't work on first load in browser it works after the browser is refreshed. It works locally fine. It just doesn't work when I clear the browser cache and load the app. I know where it is breaking but I don't know why and so can't really fix it. It thought its my machine and network but its happening in client machine and location too. Here is the code snippet ExternalInterface.call("console.log", LoaderMax.getLoader(url)+'___getLoader'); ExternalInterface.call("console.log", LoaderMax.getContent(url)+'___getContent'); var imgName:ImageLoader = LoaderMax.getLoader(url) var lgImg:ContentDisplay = LoaderMax.getContent(url); ExternalInterface.call("console.log", '===================SUCESS============='); So first two call always success and this third call only success after the page is refreshed or I disable browser cache in firebug net tab. Also let me tell you what I do to load the image after its succeed. So on a click event I just add imgName.load(true); addChild(lgImg); Amazingly I have a similar scenario in my app and I am loading a SWF from the same XML file and it works great no issues using the same method but in different class.
  2. I think I got it now. the below code works for me but not sure its the right way to do it. function moduleXMLLoaderInit(event:LoaderEvent):void { var getChildrenNum = moduleXMLLoader.getChildren()[0].getChildren(); for(var ch=0; ch<getChildrenNum.length;ch++){ if(getChildrenNum[ch].vars.rawXML.@remove== 'true'){ getChildrenNum[ch].dispose(true) } } }
  3. So,I tried to dispose the xml child in InIt event but it thows error not not sure if that can be done below is my code function moduleXMLLoaderInit(event:LoaderEvent):void { //trace("init " + moduleXMLLoader.content.children().@remove); // Works var getChildrenNum = moduleXMLLoader.content.children(); for(var ch=0; ch<getChildrenNum.length();ch++){ trace(getChildrenNum[ch].@remove)// WOrks if(getChildrenNum[ch].@remove== 'true'){ getChildrenNum[ch].dispose(true);//ERROR } } ERROR TypeError: Error #1006: value is not a function. at module_fla::MainTimeline/moduleXMLLoaderInit() at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at com.greensock.loading::XMLLoader/_receiveDataHandler() at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at flash.net::URLLoader/onComplete() I tried getChildren() but that didn't work in Init event. As I think it expecting the children name as parameter and it cannot be predicted in my case.
  4. Hi, I am streaming sound on frames in a moviclip and its placed on stage. The movie runs with below code but no sound as soon as I comment out the code and run this movie without TimelineLite and it play and sound fine. Attached FLA too sndcoin.stop(); var tl:TimelineLite = new TimelineLite(); tl.append(new TweenMax(sndcoin, 10, {frame:200}));
  5. Yes, the error is due to this line. event.target.vars.rawXML.dispose(true) Actually I don't want to load any content from that XML node. Like if I have total 10 slides then when reload a function will look for remove attribute if two found then it should only load 8 slides. So when I just disposed event.target then image is removed but the content is loading and so the slide number stays same. Thats why I am disposing XML node.
  6. Got it and working but also throwing error. any idea? function imageLoadComplete(event:LoaderEvent):void { if(event.target.vars.divsn){ trace(event.target.vars.rawXML) event.target.vars.rawXML.dispose(true) } } I thought onInit would be best place to dispose that part of XML but was not able to get attribute and target the XML node to remove. Thanks
  7. Hi, I know I wanted to this but not sure when and now its the right time to ask after spending three hours of searching. I am loading bunch of images through xml file. Its a slide by slide images with information. While user is browsing at slide 5 users are ask to select division. After the division is selected and submit button is hit the slide show is reloaded with same slide except some. So, I want to remove some images from images on fly without editing the XML. I was looking in to remove() but can't find much information about how to do that. Here is my xml file and I want to remove all the image that has attribute remove=true <ImageLoader name="img_1" url="5.jpg" remove='true'></ImageLoader> <ImageLoader name="img_2" url="6.jpg"></ImageLoader> <ImageLoader name="img_3" url="7.jpg" ></ImageLoader> <ImageLoader name="img_4" url="8.jpg" remove='true'></ImageLoader? Thanks
  8. Wow, that's good to know. I can change the name of course at one place to some thing else. By getting rawContent I was just trying to have access to course swf so that I have access to all public vars and function which now I know I can still get it by using Object(parent.parent.parent). But its still curiosity why I cant access it by getting rawContent as I use to do it in my last project where I was not using document classes.
  9. Thanks Carl, that worked. I tried earlier without static but it didn't worked because I was targeting parent.parent.preant as sprite and not as object. But what about the rawContent? I still can't access it. trace(LoaderMax.getLoader("course").rawContent);//Error
  10. Hi Carl, thanks for your quick response. I tried to make it as basic as possible and attached it. Please let me know what you think. documetClassTest.zip
  11. Hi, I had great time working on my last project with loader max and thanks Carl for all help. Last time it was my first project so I was not messing around with custom classes and all goes well. In this new project I am work with custom document classes where I parent with document class and its loading child swf with XML loader and chlid swf has its own document class. So document class on parent have variables like this as all classes have public class course extends Sprite { private var courseXMLLoader:XMLLoader; private var courseSWFs; private var targetSWFs; public static var tests = 'tessssst' public function course () { ///code here.... } Now I have succesfully loaded swf and swf has similar class which is trying to get the value of tests. It sound like regular action script and nothing to do with loaderMax. But I can get the var tests when I not using Loadermax but I have issue when I am using loaderMax. So here is the code that fails in child document class public class slideModual extends Sprite { private var slideXMLLoader:XMLLoader; private var menuFormat:TextFormat = new TextFormat(); private var ansHolder:Sprite; public function slideModual() { this.addEventListener(Event.ADDED_TO_STAGE, thisAddedToStage ) } private function thisAddedToStage(e:Event){ trace(Sprite(parent.parent) // Trace - Sprite on parent trace(Sprite(parent.parent).tests) // Trace - ERROR trace(LoaderMax.getLoader("course")); //Trace - LoaderMax 'course' trace(LoaderMax.getLoader("course").tests); //Trace - ERROR trace(LoaderMax.getLoader("course").rawContent); //Trace - ERROR } } } Any Idea please I can easily get it work when these traces on frame but not in document classes. Thank you
  12. Yep, did it. Appreciate all you help Carl and it works like a charm. Great Plugin with excellent support.
  13. Thanks Carl, Great reply. All my problems are fixed with the below code in course.fla function onInit(e:LoaderEvent):void{ //note module2.swf will be behind module.swf addChild(LoaderMax.getContent("module2.swf")); addChild(LoaderMax.getContent("module.swf")); addChild(bar); } function completeHandler(e:LoaderEvent):void{ trace("courseXMLLoader *** COMPLETE ***"); //trace(e.target.content) } Now I get the stage and the onComplete event is fired last. Still have few question. As you said I don't have to use the image holder and I agree, that's the power of LOADERMAX, but still I need to use it as I have lot of content that needs to stay with the image and it shows and hide off the stage when needed. So I use image holder to keep image and its content together. I am still using the image holder with the above code and all looks to work fine. Do you think its loading the image multiple times? Another question is about about hardcoding the module.swf file name in onInit function. I don't want to do that. I want to have the freedom of using any file name and get that name from course.xml. I am loading mulitple SWFs from course.xml. May be I can set all the file name in array and loop through the array and call addChild. Are there better options with in LoaderMax. Also thanks for encouragement. I always get in to these kind of challenging issues and I enjoys that as I am learning new things from it. I have been looking at LoaderMax for quit some time but this is the first time I am using it and its already getting so interesting. Lets see what challenge I face next. Thank you
  14. Alright, attached the simplified files. Notice that when you play the module by itself all works well but as you load in parent swf then images are not resize and get stage null. Take of the requiredRoot then child works fine in parent as well but preloader breaks. So issues. Image break out of holder when using requiredRoot. Not using required root breaks the preloader. Stage is always null in parent swf till you set event listener ADDED_TO_STAGE.(that flash issue) but adding ADDED_TO_STAGE breaks the preloader. There are also possibility that I am calling ADDED_TO_STAGE at wrong time. Actually I am calling it on very top when (parent is loader) true and then when added to stage load the XML loader hope explain well. Thank you. module.zip
×
×
  • Create New...