ilProphet
09-14-2007, 05:46 PM
does anyone have a suggestion on how to create a zoom effect using actionscript:)
|
Click to See Complete Forum and Search --> : zoom using actionscript ilProphet 09-14-2007, 05:46 PM does anyone have a suggestion on how to create a zoom effect using actionscript:) discorax 09-15-2007, 01:12 PM the property _xscale and _yscale should do you.. If you want to zoom the stage... Stage._xscale = Stage._yscale = HowMuchToZoom; cheers - Ryan ilProphet 09-17-2007, 11:03 AM thanks, I'll give it a go ilProphet 09-17-2007, 02:10 PM I get this message when i used this code: (i put the code in a movie instance) on (release){ Stage._xscale = Stage._yscale = 50; } "There is no property with the name '_xscale'." ilProphet 09-17-2007, 02:12 PM but i did try that code with on (release){ this._xscale = this._yscale = 50; } and that worked for the button, how would i apply that to the entire stage discorax 09-17-2007, 02:26 PM Stage._xscale would access the stage...but it can be wonky... SO... You probably should use _root._xscale Both can work, but Stage is a little complicated...I'd recommend trying out _root and see what results you get. Just be aware that resizing _root will change the ENTIRE flash so if you have it displaying inside a Static DIV in your HTML you could get some undesirable results. Something else to try would be to put all your content into a MovieClip on the stage and then resize that movieclip instead of resizing the stage. I made a sample FLA for you DOWNLOAD HERE (http://www.ryancdavidson.com/web/resizeFLA.zip) OR See it working HERE (http://www.ryancdavidson.com/web/resizeFLA.html). - Ryan EDIT: Additionally...the reason this._xscale works is because you're putting the action script on the movieclip. If you put your actionScript on a separate layer you'll have much more flexibility with your code. See my example FLA for how this works. ilProphet 09-17-2007, 05:23 PM thanks so much for your help, why in the AS do you have function(): Void; what does that signify? discorax 09-17-2007, 05:27 PM I'm just telling ActionScript that this function isn't going to return a value. It's referred to as Strict Data Typing. You can use functions to return values if you want. For Example if you wanted to change your age into dog years you could write a function like this. function getDogYears(yourAge):Number{ dogYears = yourAge*7; return dogYears; } So as you can see in that function a new value is returned as a Number. You can return a bunch of different data types like String, Boolean, etc... Writing function():Void just says that no value is going to be returned when this function is run. It's good coding practice. You can find out more by doing a web search for "Strict Data Typing" - Ryan ilProphet 09-17-2007, 06:04 PM Thanks again, you really know your stuff. How would you recommend starting the clip zoomed in. I used onClipEvent(enterFrame),which starts zoomed in, but this doesnt allow me to then stay zoomed out when i change the _xscale settings with a button(inside the mc). onClipEvent(enterFrame){ var counter:Number = 0; if(counter==0){ this._x = -500; this._y = 1000; } counter++; } on the button instance(i liked your advice of making your code seperated from the instance, but haven't changed it yet): on (release){ this._parent._parent._x = 200; } discorax 09-17-2007, 06:07 PM onClipEvent(load) is the first event. So you could use that to set the initial zoom. ilProphet 09-17-2007, 06:48 PM thanks again :) webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |