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 really don't follow what is happening or how the nextImage and prevImage functions are being called. is that your entire code?
  2. it could be a number of things but most likely it has to do with how the flash player resolves paths when it is inserted into a web page. when you test your swf in flash pro all the paths to your images are relative to the swf. when you preview your swf in the context of an html page the paths to the images are relative to the html page. one way of fixing this issue is to set the base attribute in your embed code: http://kb2.adobe.com/cps/041/tn_04157.html ---- also it could be that your images haven't been copied to the folder that you are using as your dreamweaver site. ----
  3. that's actually a fairly advanced effect that chipotle has. I know for myself it would take me a few hours to figure it out. to simulate the elliptical motion isn't the easiest thing in the world. GreenSock has a CirclePath2D class for animating multiple items along a circular path, but making them all offset their tween directions to make room for the object that is getting larger would take quite a bit of tinkering and custom code development. http://www.greensock.com/as/docs/tween/ ... ath2D.html perhaps someone here has done it before and can give you more beneficial advise. in the meantime, I would search http://www.activeden.net for carousel and see if there is anything similar that you can purchase for a few bucks.
  4. i quickly stripped out all the extraneous stuff. remove all the code in the actions layer of the AS2 speed test fla and paste in this: import com.greensock.*; import mx.transitions.easing.*; var mc_array:Array = []; var mc:MovieClip; var l:Number = container_mc.getNextHighestDepth(); var n:Number = 500 //number of clips var duration:Number = 1 for (var i:Number = 0; i mc = container_mc.attachMovie("mc", "mc" + l, l); mc._x = Math.random() *300; tweenTweenLite(mc, Math.random()); l++; mc_array.push(mc); } function tweenTweenLite(mc:MovieClip, percent:Number):Void { var time:Number = duration - (percent * duration); var props:Object = resetMC(mc, percent); props.onComplete = tweenTweenLite; props.onCompleteParams = [mc, 0]; //props.ease = Strong.easeIn; new TweenLite(mc, time, props); } function resetMC(mc:MovieClip, percent:Number):Object { var angle:Number = Math.random() * Math.PI * 2; var radius:Number = 600; var scale:Number = Math.random() * 250 + 50; var x:Number = 262; //center var y:Number = 215; //center var props:Object = {_x:x + Math.cos(angle) * radius, _y:y + Math.sin(angle) * radius, _xscale:scale, _yscale:scale}; if (percent != 0) { x += Math.cos(angle) * radius * percent; y += Math.sin(angle) * radius * percent; scale *= percent; } else { props.delay = Math.random() * duration scale = 5; } mc._x = x; mc._y = y; mc._xscale = mc._yscale = scale; return props; } that code is the bare minimum to create the starfield effect you can also delete the form layer. if you use this code in another file 1:make sure you have a container_mc (currently a blank movie clip in the top left corner of the stage) 2:have a symbol with linkage mc in the library (this will be your star) 3:make sure the fla is in the same folder as the com folder that contains the greensock folder
  5. Carl

    YoYo

    did you update the mc instance name to reflect the instance name of your button? i wasn't clear about that. you could probably use this as well. import com.greensock.*; mc.onRollOver = function() { if (TweenMax.isTweening(this) == false) { //the mc isn't tweening so tween it TweenMax.to(this,.5,{_x:300, repeat:5, yoyo:true}); } };
  6. Carl

    YoYo

    here is how you would make sure 1:the tween continues even after you roll off 2:the tween will not re-start if it is currently tweening import com.greensock.*; mc.onRollOver = function() { if (TweenMax.isTweening(mc) == false) { //the mc isn't tweening so tween it TweenMax.to(this,.5,{_x:300, repeat:5, yoyo:true}); } }; just a few pointers. there aren't too many situations where moving the object you rolled over away from the mouse is a great idea, primarily because that will instantly trigger a roll out. with the back and forth movement that you desire it would be very difficult to have the tween seamlessly rewind back to the beginning when you roll out AND if you did there would be a high likelihood that the object would pass under the mouse and just start another roll over tween again. the code given above is probably the safest implementation of a roll over that moves an object back and forth. although its quite possible that when the tween is finished another roll over will trigger and it will keep going and going and going.
  7. give this a whirl import com.greensock.*; import com.greensock.plugins.*; TweenPlugin.activate([TintPlugin]); var randomColor:Number; var colors:Array = [0xff0000, 0xff6600, 0x00ff66] randomColor = colors[ randomNumber(0, colors.length-1) ] TweenLite.to(MYmc, .5, {tint:randomColor}); //http://www.snorkl.tv/2011/02/use-the-proper-function-for-random-numbers-or-else/ function randomNumber(min:Number, max:Number):Number { return Math.floor(Math.random() * (1 + max - min) + min); }
  8. Carl

    YoYo

    please explain the exact behavior you wan your buttons to have on roll over and roll out. should the tween stop on roll out? should the tween re-start if already in progress on roll over? thx
  9. hi Obi_wan, welcome to the message boards! 2 things, When doing multiple tweens on the same object with TweenLite you should set the overwrite mode to 2 (there are others, but this works great for 99% of what you want). OverwriteManager.init(2); http://www.greensock.com/overwritemanager/ ----------- perhaps it may be too early in your learning (probably not) but if you want to make a sequence of tweens I strongly recommend you use TimelineLite/Max. you can easily have tweens play one after the other without doing all the onCompletes. the code would look like this: var tl:TimelineLite = new TimelineLite() tl.append( TweenLite.to(_settings, 1.5, {transformAroundPoint:{point:new Point(500,-18), rotation:-6 }, y:-18, alpha:1, ease:Bounce.easeOut }) ); tl.append(TweenLite.from(_settings, .5, {transformAroundPoint:{point:new Point(500,-18), rotation:-6 }, onComplete:tiltComplete }) ); tl.append( TweenLite.to(_settings, 1.5, {transformAroundPoint:{point:new Point(500,-18), rotation:0 }, ease:Bounce.easeOut }) ); let me know if this helps alleviate whatever problems you were experiencing. Carl
  10. if you draw your rectangle at 399 x 399 and apply a 1 pixel stroke, the width and height of the rectangle will be 400. .5 of the stroke will be overhanging each edge. its kind of weird that strokes are drawn from the center, a 1 pixel stroke gets split into half pixels which is kind of difficult to make any sense of. you will find that it will tween down to 100 x 100 without any funkiness. see if that works for you.
  11. welcome to tweening with TweenLite/Max. It will be a refreshing change from the native AS3 tweens for sure. The problem you have is more based on Flash than TweenMax. Let's take TweenMax out of the equation entirely. paste just this code into an fla: var _rect:Sprite=new Sprite(); _rect.graphics.lineStyle(1,0xffffff,1,true) _rect.graphics.drawRect(0,0,400,400); stage.addChild(_rect); trace(_rect.width, _rect.height); _rect.width = _rect.height = 500; trace(_rect.width, _rect.height); it will trace: 401 401 499.95 499.9 notice those funny numbers? so even if TweenMax tweens the width to 500, in the end Flash will read it or render it as 499.95 if you take your original code and just tween a square with a solid fill, you'll see it works just fine import com.greensock.TweenLite; var _rect:Sprite=new Sprite(); //_rect.graphics.lineStyle(1,0xffffff,1,true) _rect.graphics.beginFill(0xff0000); _rect.graphics.drawRect(0,0,400,400); stage.addChild(_rect); trace(_rect.width,_rect.height); TweenLite.to(_rect,1,{width:100,height:100,onComplete:TRACE}) function TRACE():void { trace(_rect.width,_rect.height) }
  12. Carl

    YoYo

    hi junta. in order to see the tween play back and forth you need to: specify how many times the tween should repeat and in addition set yoyo to true (default is false) Your tween should look like this: TweenMax.to(this, .1, {_x:311, repeat:5, yoyo:true}); ----- however that is not going to prevent things from getting a bit screwy if you rollover your button multiple times in quick succession. every time you rollover your button a new tween is going start. if you need help with that let us know. Carl
  13. I don't think anything like that is built in to LoaderMax/ImageLoaders. So I'd say stick with whatever logic you are using.
  14. Hi Patrick, do you want each item to tween to x:0, x:20 and then x:50? that would be just a straight line. or do the values in the array signify unique ending values for each object in the array? I'm just trying to understand better what the end goal is. if its the latter, you are going to need unique tweens for each object and a loop is the best way to go (that i can think of).
  15. darn, greensock beat me to the punch. I took a stab at this as well, but didn't have time to post before going to dinner. here's what I did: import com.greensock.*; import com.greensock.loading.*; import com.greensock.events.LoaderEvent; import com.greensock.loading.display.*; import com.greensock.easing.Back; import flash.events.MouseEvent; import flash.display.MovieClip; // var images = ["1.jpg","2.jpg","3.jpg","4.jpg","5.jpg"]; // var counter = -1; var loaderContainer_mc:MovieClip = new MovieClip(); addChild(loaderContainer_mc); addChild(btn); btn.addEventListener(MouseEvent.MOUSE_DOWN,LOAD); //; function LOAD(e:MouseEvent) { loadTester(); } // loadTester(); // function loadTester() { counter++; var img:ImageLoader = new ImageLoader(images[counter], {name:"loader" + counter, onComplete:completeHandler}) img.load() } function progressHandler(event:LoaderEvent):void { //trace("progress: " + event.target.progress); } function completeHandler(event:LoaderEvent):void { var thisContent:ContentDisplay = event.target.content loaderContainer_mc.addChild(thisContent); //reset mask height mask2_mc.height = 0; //apply mask to new content thisContent.mask = mask2_mc; //tween the mask TweenLite.to(mask2_mc, 1, {height:370, onComplete:removePrevious}); } function removePrevious(){ if(counter > 0){ trace("remove previous"); LoaderMax.getLoader("loader"+(counter-1)).dispose(true); //this trace proves there is always just 1 ContentDisplay in loaderContainer_mc trace("loaderContainer only has " + loaderContainer_mc.numChildren + " child"); }else{ trace("nothing to remove, you've only loaded the first image"); } } function errorHandler(event:LoaderEvent):void { trace("error occured with " + event.target + ": " + event.text); } zip attached. note I removed the loaderContainer_mc and its children from the fla stage. I didn't consider how it would hold up to a quick-click-load situation as greensock had pointed out. perhaps you can pick up a tip or two from each of our approaches. (his is probably better)
  16. in this simple example, kill() will stop a tween and prevent its onComplete callback from firing: import com.greensock.*; import flash.events.MouseEvent; var myTween:TweenMax = TweenMax.to(mc, 5, {x:400, onComplete:done}); function done():void{ trace("done"); } stage.addEventListener(MouseEvent.CLICK, kill) function kill(e:MouseEvent):void{ //tween will stop and onComplete will not fire myTween.kill(); } if that doesn't work in your particular setup or if you need more fine tuning goto http://www.greensock.com/as/docs/tween/ ... enMax.html under methods, there are 6 that begin with the word kill. one of those flavors of kill should be suitable for your purposes.
  17. Hi Jaytmurphy, First I would like to congratulate you on providing one of the clearest descriptions of a problem I have seen on this board. I appreciate the time you put into explaining it. Second, I don't think I would have any idea of really where to begin to help you without investing hours in going through your source and experimenting quite a bit. BUT Have you use the LinePath2D tools at all? visit this: http://www.greensock.com/as/docs/tween/ ... ath2D.html and copy paste the code into an fla with access to the greensock classes. I think you will be mildly astonished with what is available to you. ----- To answer a few of your questions. If you truly did edit the squares to have their registration points in the center, that is exactly the point TweenLite/Max will use for any transformations. If you go into symbol edit mode on any of your squares the the little cross should be in the center of your square. in your post you mentioned it should be center middle although you went on to say that the animation should be directly left... perhaps your reg point should be to the right then. If you are club greensock member the TransformAroundPoint plugin would do this for you. ---- I wish you luck on this project. its one of the more ambitious undertakings I've seen and I'm very impressed with how much of it you have gotten to work. Perhaps someone else on the board will be able to help you. I regret that I don't have the experience or time to figure it all out. Carl [edit] I looked at your fla and it appears your reg points are correct, but I also see a ton of stuff in WalkerXML that makes me think you are programmatically drawing your walkers function DrawWalker(walker_in:XMLList):Shape { var shape_stu:Shape = new Shape(); shape_stu.graphics.lineStyle(); if (walker_in.col_grad == 1) { var grad_colors:Array = new Array(walker_in.col0,walker_in.col0,walker_in.col1,walker_in.col1); shape_stu.graphics.beginGradientFill(GradientType.LINEAR , grad_colors, grad_alphas, grad_ratios, grad_matrix, "repeat"); } else { shape_stu.graphics.beginFill(walker_in.col0); } shape_stu.graphics.drawRect(0, 0, walker_in.w_start, walker_in.h_start); shape_stu.graphics.endFill(); shape_stu.x = Number(walker_in.x_start) + Number(walker_in.w_start); trace(Number(walker_in.x_start) + Number(walker_in.w_start)); shape_stu.y = walker_in.y_start; shape_stu.width = walker_in.w_start; shape_stu.height = walker_in.h_start; return shape_stu; } it doesn't appear that the symbols in your library that "look like the walkers" have any linkages set, so I don't even know if they are being used by the code. I really don't know what is going on.
  18. hello ajmeraviglia, I had a difficult time understanding your post. but it you want Txt_Symbol2 to behave like Txt_Symbol1, do this: 1: remove all the code the from your file. 2: add this code import com.greensock.*; TweenMax.to(Symbol_2,0.1,{_alpha:30, inmediateRender:true}); TweenMax.to(Txt_Symbol_2,0.1,{_alpha:40, inmediateRender:true}); var Symbol2CLicked:Boolean = false; Txt_Symbol_2.onRollOver = function() { if (!Symbol2Clicked) { TweenMax.to(Txt_Symbol_2,.5,{_alpha:100}); } }; Txt_Symbol_2.onRollOut = function() { if (!Symbol2Clicked) { TweenMax.to(Txt_Symbol_2,.5,{_alpha:30}); } }; Txt_Symbol_2.onRelease = function() { Symbol2Clicked = !Symbol2Clicked; if (Symbol2Clicked) { TweenMax.to(Symbol_2,.5,{_alpha:100}); } else { TweenMax.to(Symbol_2,.5,{_alpha:30}); } } 3: If Txt_Symbol2 now works to your liking... get rid of all your fake symbols and paste the same code again and edit it to work for Txt_Symbol1
  19. hmmm. I don't understand why the orbs would stop tweening just because their parent (the map) is scaling. very odd. here is how I would force my orbs to finish their tweens var orbTimeline:TimelineMax = new TimelineMax({paused:true}); orbTimeline.appendMultiple(TweenMax.allFrom(eforeaSpaArray, 1, {y:-29, autoAlpha:0, ease:Cubic.easeOut}, .05)); at somepoint you will have to tell this timeline to play via orbTimeline.play(); to force the timeline and its tweens to finish do orbTimeline.currentProgress=1; --- i would much rather provide a solution to the tweens abruptly stopping than a crude work-around. the orbs really should be tweening even if the map was spinning, scaling and fading in and out. Overwrite issues as far as I'm aware only come into play when you are doing multiple tweens on the same object so I don't think that's what it is. If you can somehow reproduce this undesired behavior in a simplified fla I'll definitely take a look at it. Carl
  20. Hi Bull, yeah, allFrom creates and returns an array of tweens, thus the error. to make your code not throw errors you would do var orbTweens:Array = TweenMax.allFrom(eforeaSpaArray, 1, {y:-29, autoAlpha:0, ease:Cubic.easeOut}, .05); ..but I don't know how useful that is. if you need to be able to control your allFrom tweens via a common reference such as orbTweens.play() orbTweens.reverse(); you could use appendMultiple with TimelineLite/Max and then control the tweens via the timeline instance. if you need more help let me know Carl
  21. Migrating from AS2 to AS3 can be a difficult transition, it took me a few months of diligent practice. I don't think anyone is going to do a line-by-line conversion for you as it would take a bit of time and it is not the purpose of this forum. For the most part you would have to rebuild the as2 code from scratch. This migration guide has a lot of great tips and source files: http://www.mandalatv.net/fcny/ I would suggest you write down exactly the functionality that you need and then try to build it one step at a time... for example: 1:load xml 2:load the first image 3:when image loads, fade it in 4:set a timer 5:load next image ... GreenSock has many tools in LoaderMax to make this much easier than using the native AS3 Loaders, in fact the documentation includes source code that illustrates loading an xml file and all the assets that it contains information on. http://www.greensock.com/as/docs/tween/ ... oader.html it will take some reading and experimenting but this is a great exercise to aid in your AS3 development. I am going to be doing a series of tutorials on LoaderMax very soon and will provide lots of "starter" files. I may just create a version that loops through images on a timer. If I do, I will be sure to update this post.
  22. you nested the delay in with the glowFilter props. it happens BAD TweenMax.to(mc, 1, {glowFilter:{color:0xff0000, alpha:1, blurX:30, blurY:30, strength:1, quality:2, delay:10}}); GOOD TweenMax.to(mc, 1, {glowFilter:{color:0xff0000, alpha:1, blurX:30, blurY:30, strength:1, quality:2}, delay:10});
  23. hi ade I'm having trouble understanding I have a web cam image running it timers for 5 minutes and then restarts then timeline and loadermax. perhaps if I knew more what your camera was doing. is it uploading an image to a server? does the images name change? if you are re-loading an image with the same name, I would use the unload() and also make sure you use the noCache setting. you can read more about noCache here: http://www.greensock.com/as/docs/tween/ ... oader.html
  24. are you posting all of your code? I don't see a ClassX nor do I see a score referenced anywhere.
  25. i just downloaded the latest version and tested with the file I gave you. no problems. i guess you can try saving my file next to your "not working" com folder and see if it works. either way you have a set of files that work. you should be fine.
×
×
  • Create New...