Jump to content
GreenSock

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

Carl last won the day on April 4 2019

Carl had the most liked content!

Carl

Moderators
  • Posts

    9,152
  • Joined

  • Last visited

  • Days Won

    532

Everything posted by Carl

  1. Hey Scott, What you are looking for is GreenSock's LoaderMax https://www.greensock.com/loadermax/ Unfortunately it is not available for AS2 due to the following reasons. It is possible with AS2 to determine the user's connection speed and then offer high or low quality versions of your flvs.
  2. I got the following to work with no errors. in the main movie that loads in your loaded swf have a function like: function onParentFiredFromLoaded(){ trace("the sub clip called this function in the parent container movie"); } in your loaded external swf have something like: btn.addEventListener(MouseEvent.CLICK, test); function test(e:Event){ trace("fired from btn"); trace(this.parent.parent as MovieClip); var parentMovie:MovieClip = this.parent.parent as MovieClip; parentMovie.onParentFiredFromLoaded(); }
  3. thanks toti86. It is very easy to get started with the GreenSock platform. Due to the amazing amount of features there are many goodies to learn about in the documentation and "tips" pages. Nothing wrong with starting slow and adding more as you progress. You certainly don't have to read everything before getting your feet wet or asking a question. I found that bookmarking the docs has saved me a lot of trouble:) Feel free to ask when you run into trouble and have fun. carl
  4. if you have a file with the following code: import com.greensock.*; var fadeTil:Number = 2; var tween1:TweenLite = TweenLite.to(bildeKlipp, fadeTid,{autoAlpha: 0}); var tween2:TweenLite = TweenLite.to(bildeKlipp2, fadeTid,{autoAlpha: 1, onComplete:testPause}); function testPause(){ trace("paused"); } and bildeKlipp and bildeKlipp2 (with alpha:0) on the stage, both tweens will start at the same time and testPause will run as soon as they are both finished (as they both start at the same time and finish at the same time). there must be something else you aren't showing or that isn't clear to us. with all the different comments it is difficult to figure out exactly what code you are using, where it lives and how it is fired. if you can generate a simple file that ONLY demonstrates your 2 tweens not running at the same time, it will make it much easier for us to offer a solution.
  5. it would take me awhile to investigate the proper way of doing all this, but it appears that new GlowFilter() is part of the flash.filters package http://livedocs.adobe.com/flash/9.0/Act ... ilter.html in order to access GlowFilter() you need to import that class as well. ------- when you use GreenSocks GlowFilterPlugin it communicates to the built-in filters for you. i would probably take a more generic approach like: var glowIn:Object = new Object(); glowIn = {color:0x00FF00, blurX:10, blurY:10, strength:1, alpha:1} TweenMax.to(mc, 1, {glowFilter:glowIn});
  6. You are experiencing some of the troubles a lot of beginners have. Don't fret, you are really really close. I think this tutorial will really help you: http://www.snorkl.tv/2010/08/assign-eve ... enttarget/ and this one: http://www.snorkl.tv/2010/09/tweenmax-t ... wn-by-now/ as for your code mc2.addEventListener(MouseEvent.MOUSE_OVER, thumbOver); mc2_mc.addEventListener(MouseEvent.MOUSE_OVER, thumbOut); looks like a typo as you aren't using _mc anywhere else also, using this inside your event handlers isn't what you want... you probably want e.currentTarget or e.target (see links above) var orgWidth:Number = this.width; var orgHeight:Number = this.height; in the code above this refers to the scope of where the code is so this means stage or root timeline. you probably want var orgHeight:Number = mc2.height; give the videos a watch, download the source files and let me know if you have any problems. -c
  7. cool, glad to hear it. you had me scratching my head when you mentioned there was still a half-second pause. thx for clearing that up.
  8. I think what you are seeing is the illusion of a delay based on the fact that the default ease is Quad.easeOut. this means the animation is slowing down very smoothly at the end. to have a more realistic bounce, you want your ball to speed up as it is falling as gravity would do. an easeIn works really nice for this. try: import com.greensock.*; import com.greensock.easing.* ball.x = 0; ball.y = 0; //used TweenMax to avoid initializing plugins new TweenMax(ball, 2, {x:300,y:200,bezierThrough:[{y:0}], ease:Quad.easeIn}); new TweenMax(ball, 2, {x:600,y:200,bezierThrough:[{y:0}], delay:2}); it looks great.
  9. Cool. happy to hear you got it working.
  10. whenever you sequence tweens, its great to let TimelineLite handle it. since you are just starting out, it is best to have a firm understanding of TweenLite basics before jumping in. the easiest thing to do is just create a few tweens and manually set the delay. place your clip on the stage where you want it to start and then TweenLite.to(mc, 1, {y:300, x:300}); TweenLite.to(mc, 1, {scaleX:2, scaleY:2, delay:2}); TweenLite.to(mc, 1, {x:650, delay:4});
  11. it sounds like you are moving your mouse, or items in the overlay are obstructing you hotspot and triggering a MOUSE_OUT. when the clip unloads your mouse is back over your overlay and it triggers the MOUSE_OVER causing the asset to reload again giving you the blink. its safer to use ROLL_OVER and ROLL_OUT unless you have a reason to use MOUSE_OUT. in the navOver and navOut handlers put in a trace and you will probably see these events firing often.
  12. at this point is best to test where it is breaking and then figure out why. is the MOUSE_DOWN event firing? --- add a trace to function cardDown(e){ trace("cardDown") flipSelf(e.currentTarget); } does cardDowno() know what e.currentTarget is? and is it what you expect? -- modify the trace function cardDown(e){ trace("cardDown on " + e.currentTarget) //also try e.currentTarget.name trace("cardDown on " + e.currentTarget.name) flipSelf(e.currentTarget); } does flipSelf get called? --- add trace function flipSelf(self){ trace("flipSelf() " + self); var toRot; if(self.rotationY > 89){ toRot = 0; ... } If that all works as planned then test to see if you can do a simple TweenLite on self within flipSelf(). nothing is jumping out at me about why it doesn't work other than Flash is a pain sometimes when loading external assets. get something simple working in flash before going into the browser where you can't see any traces. Carl
  13. scratch that previous answer. this will keep the timing consistant var fadeIn:TweenLite = TweenLite.to(mcA, 4, {alpha:1, onComplete:fadeOut, paused:true}); mcA.addEventListener(MouseEvent.ROLL_OVER, fadeA); mcB.addEventListener(MouseEvent.ROLL_OVER, fadeAFromB); function fadeA(e:Event):void{ fadeIn.play(); } function fadeAFromB(e:Event):void{ fadeIn.play(); } function fadeOut(){ fadeIn.reverse(); } with my first answer if the mc went alpha 0 to 1 and then started to go from 1 back to 0 and then the interrupted things at alpha of .9 it would take 2 seconds to get back to 1 which would be kinda crumby.
  14. Hi, this will always fade mcA from its current alpha to alpha 1 back to alpha 0 (even if it is currently animating). The user can trigger this action by firing events from 2 different display objects. mcA.addEventListener(MouseEvent.ROLL_OVER, fadeA); mcB.addEventListener(MouseEvent.ROLL_OVER, fadeA); function fadeA(e:Event):void{ TweenLite.to(mcA, 2, {alpha:1, onComplete:fadeOut}); } function fadeOut(){ TweenLite.to(mcA, 2, {alpha:0}); } if you need 2 unique events to do the same thing you can create a separate eventListener for each event mcA.addEventListener(MouseEvent.ROLL_OVER, fadeA); mcB.addEventListener(MouseEvent.ROLL_OVER, fadeAFromB); function fadeA(e:Event):void{ TweenLite.to(mcA, 2, {alpha:1, onComplete:fadeOut}); } function fadeAFromB(e:Event):void{ TweenLite.to(mcA, 2, {alpha:1, onComplete:fadeOut}); } function fadeOut(){ TweenLite.to(mcA, 2, {alpha:0}); } in the future please post the code you are having difficulty with as it will better help us troubleshoot your implementation Carl
  15. the activetuts premium files I suggested only uses 1 actionscript file for a single document class. although all the video features make it a little complicated, it gives a nice bird's-eye / single file look at all that takes place to load a series of assets automatically by just loading a single xml file. Given the following videoList.xml which is taken from that tutorial. i slimmed it down and added my own caption attributes: one would load all the assets by: //make an array that will be used to store a reference to all the loaders var _videos:Array; // load the xml var xmlLoader:XMLLoader=new XMLLoader("xml/videoList.xml",{name:"videoList",onComplete:xmlHandler}); xmlLoader.load(); //onComplete of the xml load start loading all the videos and put all the VideoLoaders into your _videos array function xmlHandler(event:LoaderEvent):void { trace("xml loaded"); //get the LoaderMax named "videoListLoader" which was inside our XML var queue:LoaderMax=LoaderMax.getLoader("videoListLoader"); //store the nested VideoLoaders in an array to easily loop through and reference them later on _videos=queue.getChildren(); //start loading the queue of VideoLoaders (they will load in sequence) queue.load(); } to retrieve all the captions you could just do: for (var i:Number = 0; i trace(_videos[i].vars.caption); } obviously you are loading images, but the concepts are the same. There is nothing really in the code above that would be different when dealing with images or swfs. This was the only code I had on hand. LoaderMax takes a bit of studying as it is packed with features and options. There is a bit more involved than getting a TweenLite up and running, but it is well worth the effort. If I have time this week or sometime soon I will try to make a dead-simple multi-image loader tutorial for people like you and me;)
  16. hi soupking, you can any add any attribute you like to an ImageLoader and then access the data through that loader's vars object. in your xml: in your AS3 var myImage:ImageLoader = LoaderMax.getLoader("superCar"); trace(myImage.vars.description); trace(myImage.vars.rating); if you need a more advanced data structure associate with each loader, you can use vars.rawXML -------------- from: http://www.greensock.com/as/docs/tween/ ... oader.html You may put extra data in the LoaderMax-related nodes that you'd like associated with that particular loader. XMLLoader will put all of the attributes from the XML node into the vars object of the resulting loader as well as an extra rawXML property which will contain the raw XML for that node. For example, if this node is in your XML document: ... ... Notice the "description" attribute which isn't a LoaderMax-specific property. XMLLoader will still put that value into the VideoLoader's vars property and create a rawXML property there that contains the whole XML node (including the children) so that you can easily get whatever data you need like this: function completeHandler(event:LoaderMax):void { var video:VideoLoader = LoaderMax.getLoader("video1"); var description:String = video.vars.description; var xml:XML = video.vars.rawXML; trace("first link url: " + xml.links[0].link[0].@url); //traces "first link url: http://www.greensock.com" } ---------------- I learned a ton about LoaderMax by going through the code in this tutorial: http://active.tutsplus.com/tutorials/ac ... e-premium/ be sure to click on "download premium files" ... its free... no membership required. The way they cram each loader into an array makes it very easy to access all the information of every loader. even though the tutorial focuses on video... a lot of it can be useful for structuring an image gallery. I used that tutorial for the starting point of a much more advanced and customized video player and it is insanely flexible. it was my first time using LoaderMax, and I can honestly say I will never load a single thing again without it.
  17. rjr4321, glad you are getting closer. it looks like Zync is going to hook you up. nice work Zync. Carl
  18. Hi, as far as your external classes referencing MovieClips or DisplayObjects on the stage, you could pass a reference to the mc into the external class. Think of how TweenLite works. It is an external class. When you use it you tell it exactly which objects to tween by passing them in via the constructor like so: TweenLite.to(myMovie_mc, 1, ...ete}); I will admit I'm pretty limited in my ability to give great tips on best OOP practices. Your question about appending to a TimelineLite defined in the document class could be solved in a similar fashion. Your problem is one that seems to trouble a lot of folks starting with oop. I found this reading helpful: http://tinyurl.com/4d7ssfl
  19. Your question: is a bit difficult to understand. I would start by suggesting that the following function should NOT be defined inside your switch statement inside the premuto function. function premutoUpListener():void { menu[0].addEventListener(MouseEvent.CLICK, dropUp); } I would also suggest you add some trace statements so that it is absolutely clear which part of the code isn't working. perhaps you can clarify things a bit more. thanks Carl
  20. Hi Rob, when setting a document class in Flash Pro CS4 / CS5 you do it through the properties panel. http://tv.adobe.com/watch/actionscript- ... pisode-46/ the #include directive works differently.
  21. Hi Waley, As noted in the Plugin Explorer http://www.greensock.com/club/, dynamic props is a bonus plugin that you get when you become a member. It doesn't ship with the public version of the GreenSock Platform classes. Do you have a Green or greater membership? If you are a a member and are still having problems please give a few more details of your file setup and we will be glad to help. Carl
  22. hey, this seems to work just as well and is much cleaner: import com.greensock.*; import com.greensock.loading.*; import com.greensock.easing.*; import com.greensock.events.LoaderEvent; hotspot.addEventListener(MouseEvent.MOUSE_OVER, navOver); hotspot.addEventListener(MouseEvent.MOUSE_OUT, navOut); hotspot.alpha=.5; hotspot.buttonMode=true; var loader:SWFLoader =new SWFLoader("toyota_overlay.swf",{container:this,x:0,y:0,alpha:0,name:"swf1",onComplete:completeHandler}); trace(loader); function navOver(e:MouseEvent) { loader.load(); } //this function was nested in navOver I moved it out function completeHandler(e:LoaderEvent):void { TweenLite.to(e.target.content, 1, {alpha:1}); } function navOut(e:MouseEvent):void { TweenLite.to(loader.content, 1, {alpha:.5, onComplete:disposeLoader}); } function disposeLoader() { loader.unload(); } the SWFLoader is smart enough to know whether or not it's content is loaded and won't try to reload it if it is already there. by using the unload() method in the disposeLoader function the swf gets unloaded but the SWFLoader is still hanging around knowing that it's loaded content isn't there anymore and is standing by ready to load again. Carl
  23. I'm not a SWFLoader expert, but I got the following to work: import com.greensock.*; import com.greensock.loading.*; import com.greensock.easing.*; import com.greensock.events.LoaderEvent; hotspot.addEventListener(MouseEvent.MOUSE_OVER, navOver); hotspot.addEventListener(MouseEvent.MOUSE_OUT, navOut); hotspot.alpha=.5; hotspot.buttonMode=true; var loader:SWFLoader; trace(loader); function navOver(e:MouseEvent) { //only load if the loader isn't defined if (!loader) { loader=new SWFLoader("toyota_overlay.swf",{container:this,x:0,y:0,alpha:0,name:"swf1",onComplete:completeHandler}); loader.load(); } } //this function was nested in navOver I moved it out function completeHandler(e:LoaderEvent):void { TweenLite.to(e.target.content, 1, {alpha:1}); } function navOut(e:MouseEvent):void { //the tween will throw error if the loader content isn't there //only do the tween if there is something to tween if (loader) { //tween alpha to .5 so you can see the disposeLoader function remove the swf TweenLite.to(loader.content, 1, {alpha:.5, onComplete:disposeLoader}); } } function disposeLoader() { //the loader has rawContent trace("loader raw " + loader.content.rawContent); loader.dispose(true); //the loader doesn't have rawContent trace("loader raw " + loader.content.rawContent); //nuke the loader loader=null; } There is most likely a more elegant way. This seemed to work fine when testing locally. Carl
  24. i'm not a loaderMax expert, but in an attempt to help, just wondering, are you re-creating your LoaderMax instance everytime the user tries to access a group and telling it to load? If a LoaderMax instance has loaded everything and you try to reload it, it should know that it is loaded and not try to reload. from reading: do you call LoadGroupImages multiple times? you should only create your queue once... you can attempt to load it many times but after its fully loaded it won't try to load again. if you keep repeating the "create queue" process... it will think it is a new LoaderMax and it will try to load everything again.
  25. if you can use TimelineMax instead of lite try: var timeline:TimelineMax = new TimelineMax({delay:1, repeat:-1, repeatDelay:3}); http://www.greensock.com/as/docs/tween/ ... melineMax(); other wise you can create an onComplete function that tells the TimelineLite to reverse. hopefully timelinemax will suffice, let me know if you need additional help. Carl
×