Jump to content
Search Community

Yes!

Members
  • Posts

    42
  • Joined

  • Last visited

Everything posted by Yes!

  1. Thanks Greensock. I want the base swf to consistantly be there, and swf's to load on top of that - the swf's load on top are a game, each once each game level has been played then the top swf calls to the base swf to basically unload itself and load up the next game level swf. Makes sense? So basically in old AS2 terms the swf at level 0 is constant, the swf at level 1 keeps replacing itself after the user has finished that game level - I'm using 'level' to mean two things, 1) game level, and 2) the old As2 flash meaning. So, consequently the following code would go in the swf thats being loaded on top, for some reason its just not working. MovieClip(this.parent).doSomething(); --- I'm now getting a different error : progress: 0.6466666666666666 TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::Loader@459f30e1 to flash.display.MovieClip. at testload_02_fla::MainTimeline/frame1() progress: 1 LoaderMax 'mainQueue' is complete! My understanding is that even if I use the loader.unload(); etc then I still need to call that from the swf loaded on top of the base swf, so I still need to talk between the swfs. Wow this as3 is really complex compared to this issue in as2.
  2. I get the following error: TypeError: Error #1009: Cannot access a property or method of a null object reference. at testload_02_fla::MainTimeline/frame1() So basically its not liking the following MovieClip(stage.getChildAt(0)).doSomething(); hmmmm.... any suggestions? Basically I'm referencing the first swf incorrectly. How do I reference it correctly in this instance?
  3. I'm trying to put the following in the 2'nd swf, its not working out yet. MovieClip(stage.getChildAt(0)).doSomething(); then in the first swf function doSomething() { trace("calling a function from the main timeline"); var queue2:LoaderMax=new LoaderMax({name:"mainQueue1",onProgress:progressHandler,onComplete:completeHandler,onError:errorHandler}); queue2.append( new SWFLoader("testload_03.swf", {name:"childClip1", estimatedBytes:3000, container:this, x:0, autoPlay:false}) ); ; //start loading queue2.load(); } hmmm....
  4. Trying to understand the new structure of as3 with regards to loading and unloading swfs. I'd like to replace a swf on what used to be called level 1, with another swf on level 1, by just loading a swf on that level, from the swf currently on that level, so it kicks out the current swf that called the new swf - just like it used to be in the old days of as2 - this will help me get around a problem. How can I do this with as3? Do I just do an add swf with a remove swf straight after? In my first swf I have the following that works fine. import com.greensock.*; import com.greensock.loading.*; import com.greensock.events.LoaderEvent; import com.greensock.loading.display.*; var queue:LoaderMax = new LoaderMax({name:"mainQueue", onProgress:progressHandler, onComplete:completeHandler, onError:errorHandler}); queue.append( new SWFLoader("testload_02.swf", {name:"childClip", estimatedBytes:3000, container:this, x:0, autoPlay:false}) ); //start loading queue.load(); function progressHandler(event:LoaderEvent):void { trace("progress: " + event.target.progress); } function completeHandler(event:LoaderEvent):void { // var image:ContentDisplay = LoaderMax.getContent("photo1"); // TweenLite.to(image, 1, {alpha:1, y:100}); trace(event.target + " is complete!"); } function errorHandler(event:LoaderEvent):void { trace("error occured with " + event.target + ": " + event.text); } Now, this loads a game on top of the first swf. When that game has ended I want to remove it and add another swf. Can the top swf with the game in it talk back to the swf that was first loaded and trigger a function to remove it and replace with a new one? Is this the way to do it? What does that talk back look like?
  5. With tweenlite Is it possible to do two over lapping for loops with tweens in them, and have the 2nd begin half way through the first? I tried doing this using a minus number on the end of the tween in the 2nd loop, but it was ignored and did not begin until the tweens in the first for loop had ended. Is there a way to do this as it would stop me from having to write out many tweens. Thanks.
  6. Do I need to redefine the name as the class? Here's the code, for some reason it would not post in the above message. for (var i:Number=0; i < 12; i++){ var my_mc = new chicklet(); my_mc.name = "chickletMc"+i; addChild(my_mc); } myTimeline.append( new TweenLite(chickletMc1, 0.4, {y:"+450", alpha:1, ease:Sine.easeInOut}));
  7. I think I understand why this is not working. I'm calling the class in myTimeline rather than the name - When I tween my_mc its fine, but I want to load up 13 of the same class across the screen then tween them separately. This is the error 1120: Access of undefined property chickletMc1.
  8. Thanks so much, thats the clearest, shortest explanation so far It's all becoming clearer!
  9. Hey thanks again this is making a lot of sense. One thing tho, I've hithertofore ignored private + public and packages... I'm familiar with all the code inside those, but I get Super confused with all this package / public function / private function thing and using external .as files, can you point me in the right direction to figure this out? I'm kind of getting it, but... its complex. Also, why is var curX called curX ? is it just a random name? or is there a reason to it? does cur mean something? Thanks again so much!
  10. Hey thanks! Awesome I'll take a look. Much appreciated!
  11. This is cool. What I'm not understanding is how to get the xml data into containers so I can control it? The example makes so much sense: queue.append( new ImageLoader("img/photo1.jpg", {name:"photo1", estimatedBytes:2400, container:this, alpha:0, width:250, height:150, scaleMode:"proportionalInside"}) ); However I need to bring in variables connected to images, so I'm thinking the xmlLoader is the best way to go, but then how do I parse the xml into MC containers ? The newImageLoader is way more simple/logical for me...
  12. Yes!

    Random Color

    Ah I was thinking something like this, as the colors were so weird. I realized I did not need to tween the tint, just change the color on addChild. So I've accomplished what I needed through AS only with a change color function. Feels like long winded code but it gets the job done. Tweening would be less code, but more process power? not sure... Thanks for your help!!
  13. Yes!

    Random Color

    Thanks Jack, I almost got it working. For some reason the colors are wrong. Here's the fla, the colors should match the color chips just off stage on the left. http://malcolmjackson.com/randomcolorTest.zip It's probably something real simple! Hey I have to say, you tween engine is BRILLIANT... !
  14. Yes!

    Random Color

    Here's the entire code from that section. import com.greensock.*; import com.greensock.easing.*; import com.greensock.TweenLite; import com.greensock.TimelineLite; import com.greensock.plugins.*; TweenPlugin.activate([FrameLabelPlugin, AutoAlphaPlugin, BlurFilterPlugin, TintPlugin, VisiblePlugin, ColorMatrixFilterPlugin]); import fl.motion.Color; stop(); var page=1; trace(page); ////////////////////////////////// //////////// PAGE 1 //////////// ////////////////////////////////// if (page==1) { var blockOffMc:blockOff = new blockOff(); this.addChild(blockOffMc); blockOffMc.x=0.0; blockOffMc.y=0.0; // Chicklet X placement array var testArray:Array=new Array("34","103","172","242","311","380","449","518","587","656","725","794","863"); trace(shuffleArray(testArray)); function shuffleArray(arr:Array):Array { var len:int=arr.length; var temp:*; var i:int=len; while (i--) { var rand:int=Math.floor(Math.random()*len); temp=arr[i]; arr[i]=arr[rand]; arr[rand]=temp; } return arr; } var myTimeline:TimelineLite = new TimelineLite(); var chickletMc:chicklet; var yStart=934; for (var j:Number = 0; j < 11; j++) { yStart=yStart-72; //Reshuffle Array trace(shuffleArray(testArray)); //place X randomly for (var i:int = 0; i < testArray.length; i++) { chickletMc = new chicklet(); addChild(chickletMc); chickletMc.alpha=0; chickletMc.x=testArray[i]; chickletMc.y=yStart; //myTimeline.append( new TweenLite(chickletMc, 0.75, {y:"+300", alpha:1, onStart:tweenColor}),-0.675); myTimeline.append( new TweenLite(chickletMc, 0.4, {y:"+300", alpha:1, ease:Sine.easeInOut}),-0.375); var myColors:Array=[0x17407C,0x247FBE,0x79CBF2]; function tweenColor():void { var randomColor=myColors[Math.floor(Math.random()*myColors.length)]; myTimeline.append( new TweenLite(chickletMc, 0.1, {colorMatrixFilter:{colorize:randomColor, amount:2}})); trace(randomColor); tweenColor(); } } } }
  15. Yes!

    Random Color

    I also tried using onStart to initialize, but its just acting weirdly and still not changing the colors. though it does change just one of the mc's to black... (strange)... fyi this code exists in a for loop. myTimeline.append( new TweenLite(chickletMc, 0.75, {y:"+300", alpha:1, onStart:tweenColor}),-0.675); var myColors:Array=[0x17407C,0x247FBE,0x79CBF2]; function tweenColor():void { var randomColor=myColors[Math.floor(Math.random()*myColors.length)]; myTimeline.append( new TweenLite(chickletMc, 0.1, {colorMatrixFilter:{colorize:randomColor, amount:2}})); trace(randomColor); tweenColor(); }
  16. Yes!

    Random Color

    I took a suggestion from the comments on the TweenFilterLitepage http://www.greensock.com/tweenfilterliteas3/ and changed out TweenFilterLite for TweenLite, but can't get the following to work. I did activate ColorMatrixFilterPlugin. Can anyone figure out what I'm doing wrong here? It looks like it should work a treat . var myColors:Array=[0x17407C,0x247FBE,0x79CBF2]; function tweenColor():void { var randomColor=myColors[Math.floor(Math.random()*myColors.length)]; myTimeline.append( new TweenLite(chickletMc, 0.1, {colorMatrixFilter:{colorize:randomColor, amount:2}})); trace(randomColor); tweenColor(); }
×
×
  • Create New...