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. car.jp should have been car.jpg since it is the first parameter sent into new ImageLoader() it is simply the url of the file you are loading. you can name your images however you like. and yes, setting the name of the var and the name of the loader via the name: property is largely a matter of preference OR determined by where your code goes. if you were creating ImageLoaders in a loop, the var myImage would only be a temprorary reference to that loader for(var i = 0; i var myImage = new ImageLoader("car.jpg", {name:"image"+i ...} //myImage refers to the most recently created ImageLoader so inside the loop you can reference each ImageLoader after its created using the same var name, in this case myImage. //you could set the name: property based on the value of i OR grab it from xml for something unique } after you exit the loop, myImage has no meaning so you would have to use LoaderMax.getContent("image1") or LoaderMax.getContent("car.jpg"); ------- I really don't know what a "generic pattern" would be other than sequentially naming all your images so that you could make a really basic loop output the following: var myImageLoader = new ImageLoader("images/image1.jpg", {name:"image1", container:image1_mc}); since you are using xml, you can name each ImageLoader() via the name: property whatever you like. "porsche", "jetta", "elephant"... Also, I would strongly recommend reading up on the XMLLoader so that you can define all your ImageLoader properties in xml and not have to run your own custom parsing loop: http://www.greensock.com/as/docs/tween/ ... oader.html I know, its a lot to digest at once.
  2. first import the greensock classes import com.greensock.*; import com.greensock.easing.*; then public function onMouseEvent(event:MouseEvent):void { trace (event.type); TweenLite.to(sprite, 1, {x:200}); } keep in mind every mouse event that you registered wlll cause the sprite to tween, so you should add a switch statement or temporarily remove a bunch of those listeners. you can tween a Sprite or any displayObject, it doesn't have to be a MovieClip. I don't really understand the meaning or intention behind your second question. perhaps you can explain more. please read the docs and view the interactive demos on http://www.greensock.com/tweenlite as they explain in detail the code I provided. best, Carl
  3. you're doing quite well. once you implement greensock's suggestion for targeting the proper node data in your xml, I think things are going to work quite well for you. as for some of your questions how you name the ImageLoaders is up to you. I would use either a descriptive name for each like: "sally", "bighouse", "lemonade". names like this would be stored in the xml. OR just sequentially name them based on your current loop iteration like image1, image2, image3 To access these loaders later on just do LoaderMax.getContent("sally") or LoaderMax.getContent("image2"); YOU CAN ALSO use the url of the file like getContent("assets/thumbs/someimage.jpg") but if you are going to always do that, a name property isn't necessary. the name property simply gives you the ability to choose your own way of naming and accessing loaders that is a bit more intuitive then remembering the url of each loader asset. yes hopefully my answer above helps. in some situations you may do: var myImage = new ImageLoader("car.jp", {name:"porsche" ...} myImage is a reference to that ImageLoader, so later on you could do something like addChild(myImage.content); or use the name property: addChild(LoaderMax.getContent("porsche")); or function completeHandler(event:LoaderEvent):void { var image:ContentDisplay = LoaderMax.getContent("photo1"); TweenLite.to(image, 1, {alpha:1, y:100}); trace(event.target + " is complete!"); } if you define a container, they will be added to it as soon as they load automatically. you can opt to set the alpha of that container to 0 if you like. if you don't define a container, you will have to devise a way to add the item to the displayList in an onComplete handler such as: function completeHandler(e:LoaderEvent){ addChild(e.target.content); } sounds good well worth the effort. LoaderMax as you can tell is packed with features that will make loading assets super easy and reliable. With all those features there is a bit to learn. You are kind of diving head first into a project that implements almost every feature in a very particular way. The best way to wrap your head around this is to start small and slow. I would suggest building a very small gallery of 5-10 images (no thumbnails or xml) and just experiment with the basic properties and events. Also try to target each image after load and change its alpha, scale or position... just so you learn how to "talk to it". once you are solid with those basics, you'll find that adding in the functionality of an XMLLoader isn't that big of a leap. best, Carl
  4. yeah, when your object moves away from the mouse, that will trigger the ROLL_OUT. the solution in most cases is just to create a hit area that doesn't move while the btn is moving. in your file I added an invisible button called "hit" to your home button. the general idea is that hit has ROLL_OVER/OUT listeners that trigger tweens that move your orange rectangle and text. here is a code sample: home_btn.hit.addEventListener(MouseEvent.MOUSE_OVER, homeOver); function homeOver (event:MouseEvent): void { TweenLite.to(home_btn.btn, .3, {y:-5, ease:Back.easeOut}); } ***note in the fla when creating this new movie clip which contains a "hit" area separate from the object that's moving... I changed the registration point on "Button_mc" so that the y values in the tween were easier to understand and adjust.
  5. I made a quick little demo for you: http://snorkl.tv/dev/swing/ I know you are learning GreenSock right now, so this may be a little much to start with, but since you have multiple tweens running, it is best to sequence them with TimelineLite/Max the code I used looks like: import com.greensock.*; import com.greensock.easing.*; var tl:TimelineMax = new TimelineMax() tl.append(TweenMax.fromTo(mc, 1, {rotationX:40}, {rotationX:-40, repeat:3, yoyo:true, ease:Quad.easeInOut, immediateRender:true})) tl.append(TweenMax.fromTo(mc, 2, {rotationX:40}, {rotationX:0, ease:Back.easeOut, easeParams:[5]})); the timing isn't perfect but it contains the basic meat of what you might use. this might be a bit much to swallow from the start as it uses a number of GreenSock features packed into a small space. focus first on how to get a single tween to swing an object: TweenMax.to(mc, 2, {rotationX:180} then investigate the repeat property and then TweenMax.fromTo http://www.greensock.com/as/docs/tween/ ... ml#fromTo() TimlineLite/Max is super powerful, but it can be a touch overwhelming if you jump in before having a strong foundation with TweenLite/Max. Trust me, it is well worth the effort. http://www.greensock.com/timelinelite I have a attached an cs4 fla. save it to a directory that has the greensock com folder.
  6. hi, just so you know, gotoAndLearn has their own forums where you may get help from people with more intimate knowledge of their tutorials. http://www.gotoandlearnforum.com/index.php I looked at that tutorial and it comes with a finished file. you should be able to just compare yours and the start file. perhaps if you post your code, something will jump out at us, but again, you may do better at gotoAndLearn. *** note that tutorial uses an outdated version of the greensock tweening platform. download the latest greensock files : http://www.greensock.com and update your import statements: import com.greensock.*; import com.greensock.easing.*;
  7. yes, there are some plugins that are activated by default in TweenMax. go to the PluginExplorer http://www.tweenmax.com and you will see that there are check marks next to the plugins that TweenMax activates. furthermore, if you don't want them activated you can edit the source code in com/greensock/TweenMax.as TweenPlugin.activate([ //ACTIVATE (OR DEACTIVATE) PLUGINS HERE... AutoAlphaPlugin, //tweens alpha and then toggles "visible" to false if/when alpha is zero EndArrayPlugin, //tweens numbers in an Array FramePlugin, //tweens MovieClip frames RemoveTintPlugin, //allows you to remove a tint TintPlugin, //tweens tints VisiblePlugin, //tweens a target's "visible" property VolumePlugin, //tweens the volume of a MovieClip or SoundChannel or anything with a "soundTransform" property BevelFilterPlugin, //tweens BevelFilters BezierPlugin, //enables bezier tweening BezierThroughPlugin, //enables bezierThrough tweening BlurFilterPlugin, //tweens BlurFilters ColorMatrixFilterPlugin, //tweens ColorMatrixFilters (including hue, saturation, colorize, contrast, brightness, and threshold) ColorTransformPlugin, //tweens advanced color properties like exposure, brightness, tintAmount, redOffset, redMultiplier, etc. DropShadowFilterPlugin, //tweens DropShadowFilters FrameLabelPlugin, //tweens a MovieClip to particular label GlowFilterPlugin, //tweens GlowFilters HexColorsPlugin, //tweens hex colors RoundPropsPlugin, //enables the roundProps special property for rounding values (ONLY for TweenMax!) ShortRotationPlugin, //tweens rotation values in the shortest direction //QuaternionsPlugin, //tweens 3D Quaternions //ScalePlugin, //Tweens both the _xscale and _yscale properties //ScrollRectPlugin, //tweens the scrollRect property of a DisplayObject //SetSizePlugin, //tweens the width/height of components via setSize() //SetActualSizePlugin, //tweens the width/height of components via setActualSize() //TransformMatrixPlugin, //Tweens the transform.matrix property of any DisplayObject //DynamicPropsPlugin, //tweens to dynamic end values. You associate the property with a particular function that returns the target end value **Club GreenSock membership benefit** //MotionBlurPlugin, //applies a directional blur to a DisplayObject based on the velocity and angle of movement. **Club GreenSock membership benefit** //Physics2DPlugin, //allows you to apply basic physics in 2D space, like velocity, angle, gravity, friction, acceleration, and accelerationAngle. **Club GreenSock membership benefit** //PhysicsPropsPlugin, //allows you to apply basic physics to any property using forces like velocity, acceleration, and/or friction. **Club GreenSock membership benefit** //TransformAroundCenterPlugin,//tweens the scale and/or rotation of DisplayObjects using the DisplayObject's center as the registration point **Club GreenSock membership benefit** //TransformAroundPointPlugin, //tweens the scale and/or rotation of DisplayObjects around a particular point (like a custom registration point) **Club GreenSock membership benefit** {}]);
  8. I don't know for sure, but I'm guessing your tweens are fighting each other. try using one tween that you play() and reverse(); import com.greensock.*; import com.greensock.easing.*; var slideTween:TweenMax = TweenMax.to(mc,4,{x:483,ease:Quad.easeInOut,paused:true}); slideTween.currentProgress = .5;//but mc in middle left_btn.buttonMode = right_btn.buttonMode = true; right_btn.addEventListener(MouseEvent.ROLL_OVER, btnOver); right_btn.addEventListener(MouseEvent.ROLL_OUT, btnOut); left_btn.addEventListener(MouseEvent.ROLL_OVER, btnOver); left_btn.addEventListener(MouseEvent.ROLL_OUT, btnOut); function btnOver(e:MouseEvent) { TweenMax.killTweensOf(slideTween); slideTween.timeScale = 1; if (e.target == right_btn) { slideTween.play(); } else { slideTween.reverse(); } } function btnOut(e:MouseEvent) { TweenMax.to(slideTween, .5, {timeScale:0}); } fla attached:
  9. i think it is because you are defining your tween inside a ROLL_OVER function. every time you roll over a button you are creating a new 20 second tween public function earthPanLeft(e:MouseEvent):void { var panLeftDuration:Number = Math.abs(panningEarth.width - panningEarth.x) / stage.width; earthPanLeftTween = TweenMax.to(panningEarth, 20, {x:0, paused:true}); earthPanLeftTween.timeScale = 1; earthPanLeftTween.play(); } move it outside your function like in my example. that should do it. c
  10. yup, you shouldn't be using pause() on ROLL_OUT. that will make the tween stop abruptly. please excuse the confusing comment: //advance the slideTween's progress by an additional 20% and ease out as I forgot to remove that when making the change. file attached
  11. try tweening the timeScale function btnOver(e:MouseEvent){ slideTween.timeScale = 1; slideTween.play(); } function btnOut(e:MouseEvent){ //advance the slideTween's progress by an additional 20% and ease out TweenMax.to(slideTween, .5, {timeScale:0}); }
  12. hi klu, I don't have an answer for you, but perhaps more info will help someone diagnos your problem. is this app loading the videos off a local drive? if so, is it necessary to preload them all? wouldn't they play virtually instantaneously upon request? in which case you could just load and unload them as needed? have you tested on another pc to rule out hardware issues? it seems that your pc is pretty beefy, but h.264 can be pretty demanding on the cpu/gpu. are you enabling hardware acceleration if available? have you googled about issues relating to your specific video card? have you experimented with different encoding settings/formats? My gut feeling is that LoaderMax isn't doing anything to cause problems or can do much to fix the issue, but hopefully someone can help get you closer to a fix.
  13. if its just that one image that needs to be sent to the back... import com.greensock.*; var tl:TimelineMax = new TimelineMax({repeat:-1}); tl.append(TweenLite.to(mc, 2, {x:400, onStart:sendToBack, onStartParams:[bg]})); tl.append(TweenLite.to(bg, 1, {y:"-150"})); tl.append(TweenLite.to(bg, 1, {y:"150", onStart:bringToFront, onStartParams:[bg]})); function bringToFront(object:DisplayObject):void { object.parent.addChild(object); } function sendToBack(object:DisplayObject):void { //place object at bottom-most depth object.parent.addChildAt(object, 0); } fla attached
  14. this will make the existing tween easeOut for an additional 20% on ROLL_OUT var slideTween:TweenMax = TweenMax.to(mc, 2, {x:300, paused:true}); btn.addEventListener(MouseEvent.ROLL_OVER, btnOver); btn.addEventListener(MouseEvent.ROLL_OUT, btnOut); function btnOver(e:MouseEvent){ slideTween.play(); } function btnOut(e:MouseEvent){ slideTween.pause(); //advance the slideTween's progress by an additional 20% and ease out TweenMax.to(slideTween, .5, {currentProgress:".2"}); }
  15. no problem. thanks for reporting that it works now.
  16. when testing your swf you will get a runtime error if an asset can not be loaded. if you think there is in fact an error with prependURls, the only way we will know is if we see the files you are using. please upload your fla, xml and image so that we can test. these can just be sample files that illustrate the error. note: when viewing a swf in an html page paths to external assets are relative to the html page. when viewing a swf by itself, paths are relative to the swf.
  17. use an onComplete callback: TweenMax.to(soundChannelBG, 1, {volume:0, onComplete:stoSount}); function stopSound(){ soundChannelBG.stop(); }
  18. I really don't see anything wrong or improper with what you are doing. if you want an array of all the ImageLoaders from your xml you could do yourXMLLLoaderInstance.getChildren() // it takes some important parameters docs: http://www.greensock.com/as/docs/tween/ ... tChildren() then you would have an array to loop through... so not much different then what you are doing. --------- another option would be to give all the ImageLoaders an onComplete handler that calls a single function that extracts the image.
  19. this will give you the url of the asset that you passed into the loader: function errorHandler(event:LoaderEvent):void { trace("******error loading " + event.target.url + "******"); }
  20. I would imagine you would have to make individual LinePath2D paths for each group of points. you would then make the first tween run and then trigger the the second tween on complete.
  21. i'm pretty sure the tween doesn't know what its target is until after it is created. if you defined CURRENTMC yourself prior to the tween being created then you could do: var CURRENTMC:MovieClip = text_mc; TweenNano.to(CURRENTMC, 1, {x:CURRENTMC.myX}) I'm a little unclear why if you are already defining text_mc as the target, you can' t just use it like you currently are for generating the x value. TweenNano.to(text_mc, 1, {x:text_mc.myX});
  22. the easist thing to do would be to store a reference to the individual tween you want to pause and resume var boxTween:TweenMax = new TweenMax(box, 1, {x:300}); boxTween.pause(); boxTween.play(); OR use TweenMax.getTweensOf(box) and then loop through the array of tweens and pause/resume them all http://www.greensock.com/as/docs/tween/ ... tTweensOf()
  23. Hi, You will get better support in a forum dedicated to swfAddress or a general actionscript forum like kirupa.com or actionscript.org. There may be a swfAddress expert hanging around in here but your chances of success are much higher where the forum isn't so specialized. carl
×
×
  • Create New...