Jump to content
GreenSock

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

Benjamin Waller

Members
  • Posts

    39
  • Joined

  • Last visited

Benjamin Waller's Achievements

0

Reputation

  1. Sorry for this late reply. Thanks for pointing that out. I'm getting there slowly! Appreciate both your comments. Cheers, Ben.
  2. Hi Jobbies, I was interested to understand your code and have a question. What is the prependURLs:_cs_samplesPath .? Is that (_cs_samplePath) just that a example path location to where your mp3 files are located? I was trying your code in my project and got errors, that the following properties are undefined For example: say my mp3 files are located in 2 sub folders so my location is prependURLs:folder1/folder2 Not sure how I should resolve this. Ben
  3. hello there, I'm getting an error when trying to get the Contents from an XML file as followers. Here's the code: LoaderMax.activate([imageLoader, XMLLoader, DataLoader, MP3Loader]); var loader:XMLLoader = LoaderMax.parse("viet_alphabet.xml",{name:"viet_alphabet", onComplete:parse_xml,estimatedBytes:20000}); loader.load();[/size][/font] [font=verdana,geneva,sans-serif][size=5]function parse_xml(event:LoaderEvent):void { //trace (event.target.content.letter); //var xmlList = event.target.content.letter; var firstLetter:ContentDisplay = LoaderMax.getContent("b"); trace (firstLetter); and a bit of the XML data: <?xml version="1.0" encoding="UTF-8"?> <data> <LoaderMax name="VietnameseAphabet" load="true"> <letter id="b" audioPath="assets/sound/alphabet/b.mp3"><![CDATA[b]]></letter> <letter id="c" audioPath="assets/sound/alphabet/c.mp3"><![CDATA[C]]></letter> <letter id="d" audioPath="assets/sound/alphabet/d.mp3"><![CDATA[D]]></letter> Any ideas? Cheers, Ben
  4. Hi Carl, Thanks for having a look. I was sort of hoping you might have found a glaring problem & a quick fix so I wouldn't have to strip it back but that was just wishful thinking! I tried pausing that mainIn TimelineMax instance however it just meant it didn't play at all. The issue does seem to be related to the loaded sound files only because the mainIn TimelineMax instance in the 2nd Child swf loads in and plays just fine after the 1st Child swf's TimeLineMax animation is completed. So again it seems to be the way the sound is loaded in or set up that is triggering the sound to play prematurely from the 2nd Child swf. But I appreciate your time & efforts. I'll see what I can do. Thanks again. Ben.
  5. hi again, I'm experiencing sound issues with MP3Loader when loading a series of child swfs sequentially. In this example, I'm loading 2 child swfs from Parent swf at once and playing then sequentially. Each child swf has it own MP3Loader’s with both autoPlay methods set to false. So far, the first Child swf plays first and when it completes the next Child swf starts as it is supposed to do. However, when the first sound plays from the first Child swf so does the first sound from the second Child swf at the same time. I don’t know how to stop this sound from playing until it should. The other related issue is the when the first Child swf is load for the second time, because its set up to play in a loop, the first sound isn’t being reset so that it doesn’t play again as it should. Here the code from one of the Child swfs. import com.greensock.*; import com.greensock.easing.*; import com.greensock.loading.*; import com.greensock.events.LoaderEvent; import com.greensock.plugins.TweenPlugin; import com.greensock.plugins.AutoAlphaPlugin; import com.greensock.plugins.VisiblePlugin; TweenPlugin.activate([AutoAlphaPlugin, VisiblePlugin]); import flash.events.MouseEvent; import flash.events.Event; import flash.display.Loader; import com.greensock.events.TweenEvent; import flash.display.MovieClip; import flash.events.ActivityEvent; this.Word1.visible = false; this.Word2.visible = false; this.cross1.visible = false; this.cross2.visible = false; this.tick1.visible = false; this.tick2.visible = false; this.cross1.alpha = 0; this.cross2.alpha = 0; this.tick1.alpha = 0; this.tick2.alpha = 0; ////Greensock mp3Loader //// var sound1:MP3Loader = new MP3Loader("sound/tick.mp3", {autoPlay:false}); var sound2:MP3Loader = new MP3Loader("sound/spring.mp3", {autoPlay:false}); var sound3:MP3Loader = new MP3Loader("sound/chào_Em.mp3", {autoPlay:false}); var sound4:MP3Loader = new MP3Loader("sound/chào_Anh.mp3", {autoPlay:false}); //var currentLoader:SWFLoader; //{onComplete:init} var queue:LoaderMax = new LoaderMax({paused:true}); queue.append(sound1); queue.append(sound2); queue.append(sound3); queue.append(sound4); queue.load(); // ObjectsIn array holds all assets (except for the Word1 & Word2 2nd mcs) that tween on stage independently to start the activity // ObkectsOut array holds all assets which tweens them to an Alpha of O when the activity is completed var ObjectsIn:Array = [one, two, three, four, Target1, Target2]; var ObjectsOut:Array = [one, two, three, four, Target1, Target2, Word1, Word2]; var mainIn:TimelineMax = new TimelineMax({delay:2}); // var mainOut:TimelineMax = new TimelineMax({paused:true}); mainIn.appendMultiple(TweenMax.allFrom(ObjectsIn, 3, {autoAlpha:0}));// all Obj are tweened on stage after 2 seconds //this object triggers the first sound to be played mainIn.append(TweenLite.from(Word1, 0.2, {autoAlpha:0, onStart:play1stSound}), .02); mainOut.appendMultiple(TweenMax.allTo(ObjectsOut, 3, {autoAlpha:0}), 3); // all Obj are tweened off stage after 2 seconds var Tick1:TimelineLite = new TimelineLite({paused:true}); var Tick2:TimelineLite = new TimelineLite({paused:true}); var Cross1:TimelineLite = new TimelineLite({paused:true}); var Cross2:TimelineLite = new TimelineLite({paused:true}); Tick1.append( new TweenLite(tick1, 1.2, {autoAlpha:1, onComplete:ReverseTick1})); Tick2.append( new TweenLite(tick2, 1.2, {autoAlpha:1, onComplete:ReverseTick2})); Cross1.append( new TweenLite(cross1, 1.2, {autoAlpha:1, onComplete:ReverseCross1})); Cross2.append( new TweenLite(cross2, 1.2, {autoAlpha:1, onComplete:ReverseCross2})); //Event Listeners for the 2 containers that are clickable with a glow filter /// one.buttonMode = true; two.buttonMode = true; Word1.soundIcon1.buttonMode = true; Word2.soundIcon2.buttonMode = true; three.soundIcon3.buttonMode = true; four.soundIcon4.buttonMode = true; //Word1.invisBut.buttonMode = true; one.addEventListener(MouseEvent.ROLL_OVER, objOver); two.addEventListener(MouseEvent.ROLL_OVER, objOver); one.addEventListener(MouseEvent.ROLL_OUT, objOut); two.addEventListener(MouseEvent.ROLL_OUT, objOut); //Event Listeners for sound icons that are clickable /// Word1.soundIcon1.addEventListener(MouseEvent.CLICK, play1stWordSound); Word2.soundIcon2.addEventListener(MouseEvent.CLICK, play2ndWordSound); three.soundIcon3.addEventListener(MouseEvent.CLICK, play1stWordSound); four.soundIcon4.addEventListener(MouseEvent.CLICK, play2ndWordSound); /// Glow function for current target to show user which buttons can be selected///// function objOver(e:MouseEvent):void{ var currentMC:MovieClip = MovieClip(e.target); //TweenMax.to(currentMC, .3, {colorMatrixFilter:{saturation:1, brightness:1}}); TweenMax.to(currentMC, 0, {glowFilter:{color:0xffffff, alpha:1, blurX:40, blurY:40}}); } function objOut(e:MouseEvent):void{ var currentMC:MovieClip = MovieClip(e.target); //TweenMax.to(currentMC, 1, {colorMatrixFilter:{saturation:.1, brightness:.5}}); TweenMax.to(currentMC, 0, {glowFilter:{color:0xffffff, alpha:0, blurX:40, blurY:40}}); } ///Button Sequencer Class /////// by Jody Hall var buttonArray:Array = [one, two]; var enforcer:ButtonSequencer = new ButtonSequencer(buttonArray); enforcer.addEventListener(ButtonSequencer.CORRECT, correct_onClick); enforcer.addEventListener(ButtonSequencer.INCORRECT, incorrect_onClick); /// This function shows ticks, plays sound for correct selections & tweens the correct word into place on the matching pictures//// function correct_onClick(event:Event):void { trace("correct"); if(enforcer.lastClicked == one) { trace("one clicked"); //tween the correct word into position TweenLite.to(Word1, 1, {x:Target1.x, y:Target1.y, ease:Quad.easeInOut, onComplete:DelayCall}); Tick1.play();// show the tick graphic enforcer.enabled = false; } else if(enforcer.lastClicked == two) { trace("two clicked"); // tween the correct word into position TweenLite.to(Word2, 1, {x:Target2.x, y:Target2.y, ease:Quad.easeInOut}); Tick2.play(); // tween the tick graphic TweenLite.to(Word1, 2, {autoAlpha:1}); // retween Word1 visible this.Word1.soundIcon1.visible = false; mainOut.play(); //tween all ojbs on stage (except anh_word) and waits 4 sec and Alpha's out. enforcer.enabled = false; one.buttonMode = false; three.soundIcon3.buttonMode = false; four.soundIcon4.buttonMode = false; Word1.soundIcon1.removeEventListener(MouseEvent.CLICK, play1stWordSound); Word2.soundIcon2.removeEventListener(MouseEvent.CLICK, play2ndWordSound); three.soundIcon3.removeEventListener(MouseEvent.CLICK, play1stWordSound); four.soundIcon4.removeEventListener(MouseEvent.CLICK, play2ndWordSound); } sound1.playSound();///play sound for correct sound1.gotoSoundTime(0,true); } //// This function shows incorrect clicks for both wrong selections. function incorrect_onClick(event:Event):void { trace("sorry, try again"); if(enforcer.lastClicked == one) { trace("one clicked"); Cross1.play(); sound2.playSound();///play sound for incorrect sound2.addEventListener(Event.SOUND_COMPLETE, done1); } else if(enforcer.lastClicked == two) { trace("two clicked"); Cross2.play(); sound2.playSound(); sound2.addEventListener(Event.SOUND_COMPLETE, done2) } sound2.gotoSoundTime(0,true); } ///Sound handling functions//// function play1stSound():void{ trace("first sound played from child swf 1"); //sound3.gotoSoundTime(0,true); sound3.playSound(); } function done1(e:Event):void{ trace("wait while loading the second sound"); TweenLite.delayedCall(0.2, playNextSound1) //kill any delayed calles to playNextSound TweenLite.killTweensOf(playNextSound2); //pause sound2 incase it is playing sound3.pauseSound(); } function playNextSound1(){ trace("let's play the second sound again"); sound4.gotoSoundTime(0,true); } function done2(e:Event):void{ trace("wait while loading the first sound"); TweenLite.delayedCall(0.2, playNextSound2) TweenLite.killTweensOf(playNextSound1); sound4.pauseSound(); } function playNextSound2(){ trace("let's play the first sound again"); sound3.gotoSoundTime(0,true); } function DelayCall(){ Word1.soundIcon1.buttonMode = false; Word1.soundIcon1.removeEventListener(MouseEvent.CLICK, play1stWordSound); TweenLite.delayedCall(2, SetUpNextWord) } function SetUpNextWord(){ TweenLite.to(Word1, 2, {autoAlpha:0});// fade out 1st word TweenLite.to(Word2, 2, {autoAlpha:1});// fade in 2nd word enforcer.enabled = true; one.buttonMode = true; trace("second sound played from child swf 1"); sound4.gotoSoundTime(0,true); } function ReverseTick1(){ Tick1.reverse();// fade out the tick graphic 1 one.buttonMode = false; } function ReverseTick2(){ two.buttonMode = false; Tick2.reverse(); // fade out the tick graphic 2 } function ReverseCross1(){ Cross1.reverse();// fade out the cross graphic 1 queue.load(); } function ReverseCross2(){ Cross2.reverse(); //fade out the cross graphic 2 queue.load(); } //Sounds functions for the sound icons function play1stWordSound(event:Event){ //enforcer.enabled = true; trace("sound played from 1st Word icon"); sound3.gotoSoundTime(0,true); } function play2ndWordSound(event:Event){ //enforcer.enabled = true; trace("sound played from 2nd Word icon"); sound4.gotoSoundTime(0,true); } function swfComplete(){ trace("Activity complete"); var parentMovie:MovieClip = this.parent.parent as MovieClip; parentMovie.timelineCompleteMessage(); //currentLoader.rawContent.startTimelineMax(); } function notifyParent(){ var parentMovie:MovieClip = this.parent.parent as MovieClip; parentMovie.timelineStartMessage(); } See files attached.
  6. Thanks Carl, Worked a charm. Didn't think to look at registration points. Cheers, Ben
  7. Thanks Carl, That has fixed the scaling problem but now the swf isn't positioned in the center of the container when loaded, It is offset to the right and lower than center. Any reason for that? Each swf has a stage size of 700x700 px that matches the container_mc but the assets are not wrapped in any outer mc they are mcs that are just positioned on that stage where I want them to appear. Ben
  8. Hello, I'm having another go at trying to resolve this issue. The contents (mcs) of my child swfs are scaling up and I don't know how to fix it. Could anyone please help? I have set scaleMode to "None" in the SWFLoader Vars see below. swfs.append(new SWFLoader("pair1.swf", {container:container_mc, width:700, height:700,scaleMode:"none"})); swfs.append(new SWFLoader("pair2.swf", {container:container_mc, width:700, height:700,scaleMode:"none"})); The scaling problem happens after the swfs are loaded into the parent swf. They don't scale up when you run them separately. Note: I've attached the basic files to be able to compile the parent swf. I didn't include the fla files of the 2 child swfs or Greensocks files to reduce the zip file size. Hope that enough to see where the problem may lie. See the code from the first child swf below. The only difference with the second child swf, in code, is the sound files that are loaded. import com.greensock.*; import com.greensock.easing.*; import com.greensock.loading.*; import com.greensock.events.LoaderEvent; import com.greensock.plugins.TweenPlugin; import com.greensock.plugins.AutoAlphaPlugin; import com.greensock.plugins.VisiblePlugin; TweenPlugin.activate([AutoAlphaPlugin, VisiblePlugin]); import flash.events.MouseEvent; import flash.events.Event; import flash.display.Loader; import com.greensock.events.TweenEvent; import flash.display.MovieClip; import flash.events.ActivityEvent; this.Word1.visible = false; this.Word2.visible = false; this.cross1.visible = false; this.cross2.visible = false; this.tick1.visible = false; this.tick2.visible = false; this.cross1.alpha = 0; this.cross2.alpha = 0; this.tick1.alpha = 0; this.tick2.alpha = 0; ////Greensock mp3Loader //// var sound1:MP3Loader = new MP3Loader("sound/tick.mp3", {autoPlay:false}); var sound2:MP3Loader = new MP3Loader("sound/spring.mp3", {autoPlay:false}); var sound3:MP3Loader = new MP3Loader("sound/chào_Em.mp3", {autoPlay:false}); var sound4:MP3Loader = new MP3Loader("sound/chào_Anh.mp3", {autoPlay:false}); var currentLoader:SWFLoader; //{onComplete:init} var queue:LoaderMax = new LoaderMax({paused:true}); queue.append(sound1); queue.append(sound2); queue.append(sound3); queue.append(sound4); queue.load(); // ObjectsIn array holds all assets (except for the Word1 & Word2 2nd mcs) that tween on stage independently to start the activity // ObkectsOut array holds all assets which tweens them to an Alpha of O when the activity is completed var ObjectsIn:Array = [one, two, three, four, Target1, Target2]; var ObjectsOut:Array = [one, two, three, four, Target1, Target2, Word1, Word2]; var mainIn:TimelineMax = new TimelineMax({{paused:true, delay:2}); // var mainOut:TimelineMax = new TimelineMax({paused:true}); mainIn.appendMultiple(TweenMax.allFrom(ObjectsIn, 3, {autoAlpha:0}));// all Obj are tweened on stage after 3 seconds mainIn.append(TweenLite.from(Word1, 0.2, {autoAlpha:0, onComplete:play1stSound}), 1); mainOut.appendMultiple(TweenMax.allTo(ObjectsOut, 3, {autoAlpha:0}), 3); // all Obj are tweened off stage after 3 seconds var Tick1:TimelineLite = new TimelineLite({paused:true}); var Tick2:TimelineLite = new TimelineLite({paused:true}); var Cross1:TimelineLite = new TimelineLite({paused:true}); var Cross2:TimelineLite = new TimelineLite({paused:true}); Tick1.append( new TweenLite(tick1, 1.2, {autoAlpha:1, onComplete:ReverseTick1})); Tick2.append( new TweenLite(tick2, 1.2, {autoAlpha:1, onComplete:ReverseTick2})); Cross1.append( new TweenLite(cross1, 1.2, {autoAlpha:1, onComplete:ReverseCross1})); Cross2.append( new TweenLite(cross2, 1.2, {autoAlpha:1, onComplete:ReverseCross2})); //Event Listeners for the 2 containers that are clickable with a glow filter /// one.buttonMode = true; two.buttonMode = true; //Word1.invisBut.buttonMode = true; one.addEventListener(MouseEvent.ROLL_OVER, objOver); two.addEventListener(MouseEvent.ROLL_OVER, objOver); one.addEventListener(MouseEvent.ROLL_OUT, objOut); two.addEventListener(MouseEvent.ROLL_OUT, objOut); //Event Listeners for sound icons that are clickable /// Word1.soundIcon1.addEventListener(MouseEvent.CLICK, play1stWordSound); Word2.soundIcon2.addEventListener(MouseEvent.CLICK, play2ndWordSound); three.soundIcon3.addEventListener(MouseEvent.CLICK, play1stWordSound); four.soundIcon4.addEventListener(MouseEvent.CLICK, play2ndWordSound); /// Glow function for current target to show user which buttons can be selected///// function objOver(e:MouseEvent):void{ var currentMC:MovieClip = MovieClip(e.target); //TweenMax.to(currentMC, .3, {colorMatrixFilter:{saturation:1, brightness:1}}); TweenMax.to(currentMC, 0, {glowFilter:{color:0xffffff, alpha:1, blurX:40, blurY:40}}); } function objOut(e:MouseEvent):void{ var currentMC:MovieClip = MovieClip(e.target); //TweenMax.to(currentMC, 1, {colorMatrixFilter:{saturation:.1, brightness:.5}}); TweenMax.to(currentMC, 0, {glowFilter:{color:0xffffff, alpha:0, blurX:40, blurY:40}}); } ///Button Sequencer Class /////// by Jody Hall var buttonArray:Array = [one, two]; var enforcer:ButtonSequencer = new ButtonSequencer(buttonArray); enforcer.addEventListener(ButtonSequencer.CORRECT, correct_onClick); enforcer.addEventListener(ButtonSequencer.INCORRECT, incorrect_onClick); // Sound 1 loaded function play1stSound():void{ trace("first sound played from child swf 1"); //sound3.gotoSoundTime(0,true); sound3.playSound(); } /// This function shows ticks, plays sound for correct selections & tweens the correct word into place on the matching pictures//// function correct_onClick(event:Event):void { trace("correct"); if(enforcer.lastClicked == one) { trace("one clicked"); //tween the correct word into position TweenLite.to(Word1, 1, {x:Target1.x, y:Target1.y, ease:Quad.easeInOut, onComplete:DelayCall}); Tick1.play();// show the tick graphic enforcer.enabled = false; } else if(enforcer.lastClicked == two) { trace("two clicked"); // tween the correct word into position TweenLite.to(Word2, 1, {x:Target2.x, y:Target2.y, ease:Quad.easeInOut}); Tick2.play(); // tween the tick graphic TweenLite.to(Word1, 2, {autoAlpha:1}); // retween Word1 visible this.Word1.soundIcon1.visible = false; mainOut.play(); //tween all ojbs on stage (except anh_word) and waits 4 sec and Alpha's out. //firstWordOut.play() enforcer.enabled = false; } sound1.playSound();///play sound for correct sound1.gotoSoundTime(0,true); } //// This function shows incorrect clicks for both wrong selections. function incorrect_onClick(event:Event):void { trace("sorry, try again"); if(enforcer.lastClicked == one) { trace("one clicked"); Cross1.play(); sound2.playSound();///play sound for incorrect sound2.addEventListener(Event.SOUND_COMPLETE, done1); } else if(enforcer.lastClicked == two) { trace("two clicked"); Cross2.play(); sound2.playSound(); sound2.addEventListener(Event.SOUND_COMPLETE, done2) } sound2.gotoSoundTime(0,true); } function done1(e:Event):void{ trace("done playing sound1 now wait"); TweenLite.delayedCall(0.2, playNextSound1) //kill any delayed calles to playNextSound TweenLite.killTweensOf(playNextSound2); //pause sound2 incase it is playing sound3.pauseSound(); } function playNextSound1(){ trace("let's play the next sound"); sound4.gotoSoundTime(0,true); } function done2(e:Event):void{ trace("done playing sound1 now wait"); TweenLite.delayedCall(0.2, playNextSound2) TweenLite.killTweensOf(playNextSound1); sound4.pauseSound(); } function playNextSound2(){ trace("let's play the next sound"); sound3.gotoSoundTime(0,true); } function DelayCall(){ TweenLite.delayedCall(2, SetUpNextWord) } function SetUpNextWord(){ TweenLite.to(Word1, 2, {autoAlpha:0});// fade out 1st word TweenLite.to(Word2, 2, {autoAlpha:1});// fade in 2nd word enforcer.enabled = true; trace("second sounds for second word played"); sound4.gotoSoundTime(0,true); } function ReverseTick1(){ Tick1.reverse();// fade out the tick graphic 1 one.buttonMode = false; } function ReverseTick2(){ two.buttonMode = false; Tick2.reverse(); // fade out the tick graphic 2 } function ReverseCross1(){ Cross1.reverse();// fade out the cross graphic 1 queue.load(); } function ReverseCross2(){ Cross2.reverse(); //fade out the cross graphic 2 queue.load(); } function play1stWordSound(event:Event){ //enforcer.enabled = true; trace("sound played from 1st Word"); sound3.gotoSoundTime(0,true); } function play2ndWordSound(event:Event){ //enforcer.enabled = true; trace("sound played from 2nd Word"); sound4.gotoSoundTime(0,true); } function swfComplete(){ trace("Activity complete"); var parentMovie:MovieClip = this.parent.parent as MovieClip; parentMovie.timelineCompleteMessage(); //currentLoader.rawContent.startTimelineMax(); } function notifyParent(){ var parentMovie:MovieClip = this.parent.parent as MovieClip; parentMovie.timelineStartMessage(); }
  9. Hi X10, Thanks for the reply. I'm not having much luck. I haven't set the height and width on the content display but I inserted the scaleMode:"none" code into the SWFLoader Vars but that didn't work, the swfs are still stretching their contents up. Also, I tried setting the first timeline to {paused:true} in the Child SWFs TimelineMax constructors but then the swfs didn't load on stage. I think the issue of overlapping is a bit more complicated because in my swfs I don't just have one single TimelineMax instance in the swfs. I have one TimelineMax for the assets coming on stage & the another one to control them going off stage when the activity is competed. Whereas Carl's example uses a single TimelineMax instance in each Child swf. But by using the latter TimelineMax that completes the swfs in my situation it does seem to work, I mean once one swf is finshed the next loads. So the issue is around the sound; the first sound file from the 2nd swf plays at the same time as the sound from the 1st swf plays. And I have {autoPlay:false} in each MP3Loader instance for each sound file so that shouldn't let them play prematurely! So I'm very stumped! Any more suggestions? Cheers, Ben.
  10. Hi Carl and X10, Sorry X10. I cross posted the last issues I was having on another thread: http://forums.greensock.com/viewtopic.php?f=6&t=3649&start=10 But Carl kindly posted a working example of how to LoadSwfsThatContainTimeLineMax. So please check that out! I have been trying to implement this last example Carl and I'm still trying to sort of the issues. I'm not getting any compiler errors but I'm getting a number of odd behavior. I'll try to explain: 1. Scaling problem. The 2 swfs of mine don't size properly when loaded into the container. They are scaled up I would guess twice the size as they should be. 2. Swf 2 plays it first sound before it should. When the first swf loads and plays its first sound file so does the swf 2. So it is triggering the sound of the swf child 2. Any ideas? You might need to see my swf Child files to really see what's happening. Let me know. Cheers, Ben
  11. Thanks Carl. Much appreciated. I'll give it a go and post my results. Cheers, Ben.
  12. Hi Carl, Yes I guess I should have posted to the other thread. I only posted on this thread after I didn't a search on this site for the same error message that I was getting so I thought I'd post here instead. I do appreciate the help. Ben.
  13. Sorry. So if I don't use the LoaderMax instance to load the swfs because the e.target.rawContent can't reference it. Could I use the SWFLoader instead ? would that solve the error message I'm getting? I've been able to have a single child swf load and animate its content fine and now I'm trying to load a number of swfs in a sequence one after the other but I am getting the rawContent error message. The other issue is that all swfs are playing simultaneously. What I looking at doing is having the first swf play through its animation & when the first is completed it's animation the second swf starts etc.... So should I do this? var swfs:SWFLoader = new SWFLoader({name:"mainQueue", onComplete:loadComplete, onChildComplete:childCompleteHandler}); swfs.append(new SWFLoader("pair1.swf", {container:container_mc, autoPlay:false})); swfs.append(new SWFLoader("pair2.swf", {container:container_mc, autoPlay:false})); swfs.append(new SWFLoader("pair3.swf", {container:container_mc, autoPlay:false})); swfs.append(new SWFLoader("pair4.swf", {container:container_mc, autoPlay:false})); function loadComplete(e:LoaderEvent):void{ trace("all swfs loaded"); var loadedTimelineMax:TimelineMax= e.target.rawContent.mainIn;
  14. ok I get it. But how about if I use SWFLoader instead? var swfs:SWFLoader = new SWFLoader({name:"mainQueue", onComplete:loadComplete, onChildComplete:childCompleteHandler});
  15. Hello Jack, I'm getting the same message here but i'm not using an LoaderMax instance, I'm using SWFLoader. Here's my code. import com.greensock.*; import com.greensock.events.TweenEvent; import com.greensock.events.LoaderEvent; import com.greensock.loading.*; var loaderIndex:Number = -1; var currentLoader:SWFLoader; var swfs:LoaderMax = new LoaderMax({name:"mainQueue", onComplete:loadComplete, onChildComplete:childCompleteHandler}); ///This append method of yours is how I want to load the swfs//// swfs.append(new SWFLoader("pair1.swf", {container:container_mc, autoPlay:false})); swfs.append(new SWFLoader("pair2.swf", {container:container_mc, autoPlay:false})); swfs.append(new SWFLoader("pair3.swf", {container:container_mc, autoPlay:false})); swfs.append(new SWFLoader("pair4.swf", {container:container_mc, autoPlay:false})); swfs.load(); function childCompleteHandler(e:LoaderEvent):void { trace(e.target + " loaded"); e.target.content.visible = false; } function loadComplete(e:LoaderEvent):void{ trace("swf loaded"); //reference the TimelineMax in the loaded swf // Carl, this mainOut is the finial timeline that completes the activity/// var loadedTimelineMax:TimelineMax= e.target.rawContent.mainIn; initCurrentLoader(); trace(loadedTimelineMax); //track when the loaded TimelineMax is done playing loadedTimelineMax.addEventListener(TweenEvent.COMPLETE, timelineCompleteMessage); //tell the loaded TimelineMax to play loadedTimelineMax.play(); } function initCurrentLoader() { loaderIndex++; if (loaderIndex == swfs.numChildren) { //reset back to 0 if the last swf has already played loaderIndex = 0; } //dynamically reference current loader based on value of loaderIndex currentLoader = swfs.getChildAt(loaderIndex); //make the content of the current loader visible currentLoader.content.visible = true; //tell the current loader's swf to to play currentLoader.rawContent.startTimelineMax(); //currentLoader.rawContent.gotoAndPlay(1); } function timelineCompleteMessage(e:TweenEvent):void{ trace("the parent has detected that the TimelineMax in the loaded swf is COMPLETE"); } function timelineStartMessage():void{ trace("the timeline started playing and the child swf told the parent swf to display this message\n"); } Do you what I'm doing wrong? Ben.
×