Jump to content
Search Community

Carl last won the day on December 24 2023

Carl had the most liked content!

Carl

Moderators
  • Posts

    9,824
  • Joined

  • Last visited

  • Days Won

    546

Everything posted by Carl

  1. i am not familiar with setSize {width:520.30, height:119} if you want to tween the width and height while the position is changing just do: TweenMax.to (a13, 1.5, {x:88.15, y:264.3, width:520.30, height:119, ease:Bounce.easeOut}); if you want to tween the width and height at a different rate/speed just use 2 tweens: TweenMax.to (a13, 1.5, {x:88.15, y:264.3, ease:Bounce.easeOut}); TweenMax.to (a13, .2, {width:520.30, height:119}); if you want to set the new size immediately just do: a13.width = 520.30 a13.height = 119 TweenMax.to (a13, 1.5, {x:88.15, y:264.3, ease:Bounce.easeOut});
  2. you may also find my post here: viewtopic.php?f=1&t=4819&p=20618&hilit=bezier#p19462 to be helpful. can't imagine there being a performance loss. TweenLite is highly optimized. if you only need to run the tween after all the points are created, add each point object to an array and then pass that points array into a bezierTrough tween. //the following demonstrates clicking 4 times to create a single bezierThrough tween: var clickCount:Number = 0; var points:Array = [] stage.addEventListener(MouseEvent.CLICK, addBezierTween); function addBezierTween(e:MouseEvent):void{ clickCount ++; points.push({x:mouseX, y:mouseY}); if(clickCount == 4){ //play the tween TweenMax.to(mc, 5, {bezierThrough:points}); } }
  3. it appears the first item that gets clicked loads on the first click but subsequent assets take 2 clicks. please post the code you are using to load the assets.
  4. before trying to attempt what you saw in the tutorial, I would focus on converting your timeline animation to Tweenlite so that all the motion is controlled by code. it could be as simple as TweenMax.to(map, 1, {x:-300, repeat:-1}); //use values that suit your project the tutorial you referenced is better suited for more complex animations where multiple items are sharing common sequences of animation.
  5. if you want to use repeat, use TweenMax.
  6. i'm 99% certain that changing the frame rate is only possible with AS3. with TweenLite/Max you can tell a movie clip to tween the playback of its frames. So something like this: TweenMax.to(mc, 4, {frame:100}) will play through to frame 100 in 4 seconds. you can also tween the currentProgress or timeScale property of the tween to have it speed up or slow down.
  7. just a suggestion, you may want to consider posting this in a few other forums such as kirupa.com or actionscript.org. I'm sure there are people that can help you here that are smarter than me, but since your problem is pretty much focused on a mathematical problem you might find a quicker answer where there is a larger and broader audience. best, Carl
  8. see if this helps: viewtopic.php?f=1&t=4355&p=17299&hilit=smooth+rotation#p17299
  9. its an interesting problem. usually with bezier stuff you have a arrays of points pre-made and then you just pass them in to a single tween. if you want to keep adding points as the tween is happening it gets... interesting. I was scratching my head for a bit on this, but found a pretty straightforward solution using TimelineMax. an import thing to note for anyone reading this is that, any bezier segment takes into account 3 points: 1) where the mc starts (the bezier tween just uses the mc's current position automatically) 2) a control point that it passes through 3) where it should end Also keep in mind that every time the user clicks they are alternating between adding CONTROL points and DESTINATION points. when your app starts an mc will be sitting on stage. first click creates a control point : no tween added second click creates a destination point : animation can occur third click creates another control point : no tween added fourth click creates another destination point : tween added. ...repeat I assume if the user clicks repeatedly you don't want to start the entire sequence over again, but rather the app should just remember all the points and tween continuously through them all. TimelineMax to the rescue! what we can do is track the number of clicks and determine whether or not the click is a control point or a destination point. if the click is a control point, it just gets added to our x/y arrays. if the click is a destination point we add it to our x/y arrays and append a new TweenMax to a TimelineMax that uses the previous point as a control point, and the most recent click as a destination point. what is great about this method is that when the Tween is created it appears that the starting value is recorded or set as the destination point in the previous tween and not the mc's current position. here is an example: http://www.snorkl.tv/dev/bezierTimeline/ import com.greensock.*; import com.greensock.plugins.TweenPlugin; import com.greensock.plugins.BezierThroughPlugin; TweenPlugin.activate([bezierThroughPlugin]) var xA:Array = [mc.x]; var yA:Array = [mc.y]; var clickCount:Number = 0; message_txt.text = "click anywhere to add the first control point"; stage.addEventListener(MouseEvent.CLICK, addBezierTween); var tl:TimelineMax = new TimelineMax() function addBezierTween(e:MouseEvent):void{ clickCount ++; xA.push(mouseX); yA.push(mouseY); if(clickCount%2 == 0){ trace(" add endPoint"); message_txt.text = "click anywhere to add another CONTROL point"; tl.append(TweenMax.to(mc, .5, {bezierThrough:[{x:xA[clickCount-1], y:yA[clickCount-1]}, {x:xA[clickCount], y:yA[clickCount]} ]})); tl.play(); }else{ trace("add controlPoint"); //visually mark the control point var newControl:ControlPoint = new ControlPoint(); newControl.x = mouseX; newControl.y = mouseY; addChild(newControl); message_txt.text = "click anywhere to add a DESTINATION point"; } TweenMax.fromTo(message_txt, .5, {alpha:0}, {alpha:1}); }
  10. from an older greensock post: var loader:SWFLoader = LoaderMax.getLoader("NameOrURLOfwhateverSwfYouAreTryingToPlay"); if (loader.status == LoaderStatus.COMPLETED) { //do stuff immediately... } else { trace("swf isn't loaded"); //in case you want to prioritize it now and then play it when it is done //note you will have to create a completeHandler loader.addEventListener(LoaderEvent.COMPLETE, completeHandler); loader.prioritize(); }
  11. In order to see if a loader is truly prioritized, you can view every loader's status and progress in your own little debug window. add this line after your _queue is constructed var childLoaders:Array = _queue.getChildren(); place a dynamic textfield called output on the stage and make sure it is set to handle multi-line text. add the following to your QueueProgress() output.text =""; for(var n=0; n output.appendText( childLoaders[n].name+ " : " + childLoaders[n].status + " : " + childLoaders[n].progress + "\n" ); } this will loop through all your loaders and give you the name, status and progress of each loader. this will allow you to see that a loader has been prioritized. the status codes are as follows 0 LoaderStatus.READY 1 LoaderStatus.LOADING 2 LoaderStatus.COMPLETED 3 LoaderStatus.PAUSED 4 LoaderStatus.FAILED 5 LoaderStatus.DISPOSED. To prevent your swf from playing, use autoPlay:false in the special properties vars for each SWFLoader it seems that markavian gave you great info on having your loader bar display the info for an indvidual loader.
  12. is the textfield created before or after the timeline code is run? it needs to happen before. is this code inside BG? var myTextLoader:URLLoader = new URLLoader(); var Text_News:TextField = new TextField(); myTextLoader.addEventListener(Event.COMPLETE, onLoaded); function onLoaded(e:Event):void { Text_News.htmlText = e.target.data; addChild(Text_News); } myTextLoader.load(new URLRequest("Text/News.html")); the best thing you can do at this point is add a trace right beneath your timeline code: trace(BG.Text_News) if it is there you should get something like [object TextField] in your output. if you don't get a favorable trace, double check your instance names and paths.
  13. give the movie clip that CONTAINs targetMC the instance name parentMC. using "parent" as an instance name is going to to cause problems with the ActionScript reserved keyword parent. change your code to say: timeline.append( TweenMax.to(parentMC.targetMC, 1, {alpha:1})); that should do it.
  14. yeah, that's pretty much the gist of it BUT you also need to specify the URL of the swf _queue.append(new SWFLoader("nameOfSwf.swf", {name:"menu1", onComplete:Menu1Complete, estimatedSize:20000}); instead of adding the swf to the display list in the onComplete handlers, you CAN specify a container that the loaded swf will automatically get placed into. its a really handy feature: _queue.append(new SWFLoader("nameOfSwf.swf", {name:"menu1", container:menu1Holder_mc, onComplete:Menu1Complete, estimatedSize:20000}); //in this case you would only need the onComplete if there was something specific to this file being loaded that you were tracking.
  15. Carl

    fades

    the reason your menu is disappearing is because when you ROLL_OVER sub (which is on a layer on top of projects frame) you are technically doing a ROLL_OUT of projectsframe. projectsframe ROLL_OUT tells sub to set its alpha to 0. drop down menus are much easier to activate with a click. when you activate them on rollover, chances are you are going to rollout of the thing you were previously over i order to get to the sub menu. furthermore if your submenu buttons have rollover effects you wind up with lots of "buttons in buttons" and a bunch of different events fighting with each other. in short they never have been easy to do in flash. back in the old'n days people would do all sorts of whacky things like put an invisible button around or behind the sub-menu so that when you rolled off the sub menu and on to this invisible button it would close the menu. yeah its confusing. I really don't have the time to fix your file. but i provided an example of a menu that opens and closes nicely when it should. The way it works may not be the easiest thing to figure out. http://www.snorkl.tv/dev/dropdown/dropdown.html (source attached) Carl
  16. Hey X10, Congrats on getting into LoaderMax. Unfortunately what you describe as simple is actually a bit complicated. I've never done this before so I don't have an exact code solution, but here is some theory: when both swfs are fully loaded: tell swf 1 to play its timeline swf1's timeline must have an onComplete eventHandler that communicates to the parent swf that it is done playing. the parent swf needs to have a function in it that will then communicate to swf2 that its timeline must play. Technically, I imagine your swf1 could talk directly to swf2, but for some reason that sounds more troubling to me. If I have time later today I'll try to get something like this work. ------ just realized i had some sample files laying around demonstrating how a parent can communicate with a child swf and vice versa. PARENT FLA: functionFromSub.fla import com.greensock.*; import com.greensock.loading.*; import com.greensock.easing.*; import com.greensock.events.LoaderEvent; var loader:SWFLoader; //load an external swf loader=new SWFLoader("ext.swf",{container:this.holder,x:0,y:0,alpha:0,name:"swf1",onComplete:completeHandler}); loader.load(); //when loading done, fade it in function completeHandler(e:LoaderEvent):void { TweenLite.to(e.target.content, 1, {alpha:1}); } function onParentFiredFromLoaded(){ trace("the loaded clip called this function"); } stage.addEventListener(MouseEvent.CLICK, testFunctionInSub); function testFunctionInSub(e:Event){ //call a function FROM this Movie IN the LOADED movie LoaderMax.getLoader("swf1").rawContent.calledFromMain(); } this file loads a swf called ext.swf and fades it in when loaded. clicking anywhere in the parent (functionFromSub.swf) will fire a function in the loaded swf (ext.swf) EXTERNAL SWF: ext.swf trace("subSwf is here"); btn.addEventListener(MouseEvent.CLICK, test); //this function calls a function in parent: functionFromSub.swf function test(e:Event){ trace("fired from btn"); trace(this.parent.parent as MovieClip); //YOUR PATH MAY HAVE TO CHANGE THE NUMBER OF PARENTS... NOT SURE. var parentMovie:MovieClip = this.parent.parent.parent as MovieClip; parentMovie.onParentFiredFromLoaded(); } //this function gets called FROM parent: functionFromSub.swf function calledFromMain():void{ trace("calledFromMain"); } this swf can communicate TO the swf it was loaded INTO and also has a function that can be triggered FROM its parent. click on this red swf to see its parent fire a trace from onParentFiredFromLoaded(); These files only really trace messages, but should be a good starting point for ParentSwf > ChildSwf communication. see attached Carl
  17. Hi Donald, I don't see any code that would illustrate how the "re-load" happens. I would think to re-load the sound after you have disposed and unloaded it, you would have to re-declare a NEW sound. I was expecting to see an eventListener of some type on your draggableList that would update what sound is every time a new item was selected. from what I'm seeing I can only guess this is not happening. once you dispose sound, it no longer exists, so playing it isn't going to work. make sense?
  18. Hi Hank, Can you please post the code you are using to loop the video? how are you triggering the loop? are you running a time check on PLAY_PROGRESS? a simple fla with sample video would be greatly helpful in addition. If at any point the playhead reaches the last frame of the video, VIDEO_COMPLETE should fire. are you saying it is firing somewhere in the middle?
  19. if you are using a bitmap make sure you have enabled smoothing 1) if the bitmap is a library asset, right click > properties > allow smoothing (checked); 2) if the bitmap is being loaded externally, use an ImageLoader as it will smooth by default: http://www.greensock.com/as/docs/tween/ ... oader.html 2a) if you are not using an ImageLoader, google "smooth loaded image as3" If you are using a vector, I imagine that there just aren't enough pixels available to accurately display such incredibly minute changes in rotation. if your mc starts at a rotation of 0 and your end position is rotation:1 and your frame rate is 30 frames per second. each frame has to render in roughly 1/60th of a degree increments which is quite a feat.
  20. yeah, but you need 2 separate tweens: TweenMax.to(mc, 1, {alpha:1}) TweenMax.to(mc, 2, {rotation:360}) if using TweenLite you will have to set the OverwriteManager to auto mode http://www.greensock.com/overwritemanager/
  21. Ha! hey, my reasoning wasn't too far off, but I didn't expect the solution to be that simple:) thanks for posting your results. i'm sure it will help me or someone else in the future. great work. Carl
  22. first off, that's a great cube spin and flip-aroo effect that you have there. very cool. being that going from question to answer to question to answer to question works flawlessly, and clicking the "i" button is what messes it all up, I'd start looking at what the i button does does the i button set the visible, alpha or rotationX values of mcTRIVIA_A or mcTRIVIA_B? if so, when you flip from "preferences" back to trivia are both trivia_a and trivia_b set to the exact same rotationX and visible/alpha setting as they were prior to the flip? if pressing i sets the alpha of trivia_a to 0 is it ALSO setting the visible to 0? you need to make sure that when i is pressed, if you are changing visible or alpha of any clips using the visible plugin that BOTH alpha and visible are set to off and then when you close out of preferences BOTH these settings get set back to what they were prior. It appears that the "visible" aspect of the tweens is in fact ending where it should be but not STARTING where it should, which prevents you from seeing the rotation. another guess: the rotation isn't even happening. meaning if for some reason trivia_a already has a rotationX of 0 and you tween it to a rotationX of 0 then there is no where for it to tween to. so you will just see nothing happening and then whammo! visible:1 makes it appear when the tween's duration has expired. THE FIRST THING I WOULD DO TO TEST: take visible out of the occasion ENTIRELY. yeah, your file make look weird but you will at least be able to verify whether or not your clips are spinning in 3d space properly. once you can verify that the animation is happening then add a little bullet proofing to the mix by forcing the tweens to START with the proper visible/alpha/rotationX settings like so: first flip mcTRIVIA_Q.alpha = 1; mcTRIVIA_Q.visible = true; mcTRIVIA_Q.rotationX = 0; mcTRIVIA_A.alpha = 0; mcTRIVIA_A.visible = false; mcTRIVIA_A.rotationX = -90; TweenLite.to(mcTRIVIA_Q, 0.4, {rotationX:-90, visible:0, ease:Expo.easeIn}); TweenLite.to(mcTRIVIA_A, 0.4, {rotationX:0, visible:1, delay:0.4, ease:Expo.easeOut}); second flip mcTRIVIA_A.alpha = 1; mcTRIVIA_A.visible = true; mcTRIVIA_A.rotationX = 0; mcTRIVIA_Q.alpha = 0; mcTRIVIA_Q.visible = false; mcTRIVIA_Q.rotationX = -90; TweenLite.to(mcTRIVIA_A, 0.4, {rotationX:90, visible:0, ease:Expo.easeIn}); TweenLite.to(mcTRIVIA_Q, 0.4, {rotationX:0, visible:1, delay:0.4, ease:Expo.easeOut}); now that I think about it a fromTo tween might do the trick as well. --------------------------- my gut feeling is that somehow the starting values of your tweens are getting messed up, and not the end values. that's why i manually threw all those property resets in there. i haven't quite rationalized though why after you flip a few more times (after returning from preferences)... things don't naturally get themselves worked out. normally i'd say upload a simplified fla, but in this case it would be pretty difficult to strip that thing down and i imagine the file as it is might be to complicated for anyone to make sense of easily. -------- also there is good deal that happens when you go TO preferences and then BACK to trivia that could be causing problems. let us know what you find.
  23. just to be super clear, please confirm the following 1: your com folder and fla are in the same parent folder (fla NOT in com folder) 2: the greensock folder is in the com folder 3: your import statement looks like this: import com.greensock.*; ---------------- OR post a zip of of the folder that contains all of your source files (assuming you are using the PUBLIC free version of greensock) thanks.
  24. basically TweenLite can't find guagGroup2_mc or nsGroup_mc. this can be for a variety of reasons 1) these names in the code do not match the names on the symbols. 2) one of those movie clips is not present on the same frame that the code lives in. add this to your code above the tweens trace("guagGroup2_mc is " + guagGroup2_mc); trace("nsGroup_mc is " + nsGroup_mc); what do you get?
×
×
  • Create New...