Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Zoom Class



Hi! I'm trying to zoom into a map with the Zoom Class in AS3http://livedocs.adobe.com/flash/9.0/Act ... /Zoom.htmlBut after the button is clicked, my movie clip disappears and zooms from the upper left hand corner and back into stage view as the original size. I'd like to click the button and zoom into my map from the original view. I've tried using scaleX and scaleY, which helps to scale the movie clip, but the entire clip still disappears and then zooms in from the corner. My code is below, thanks in advance for your help Code: import fl.transitions.*;import fl.transitions.easing.*;      mc_wholeMap.btn_SEC.addEventListener(MouseEvent.CLICK, zoomSEC);function zoomSEC(evt:MouseEvent):void {   mc_wholeMap.scaleX +=0.5;   mc_wholeMap.scaleY +=0.5;      TransitionManager.start(mc_wholeMap, {type:Zoom, direction:Transition.IN, duration:3, easing:Regular.easeInOut});      mc_wholeMap.btn_SEC.visible = !mc_wholeMap.btn_SEC.visible;}



Actionscript 3.0
Posted on: Tue Aug 12, 2008 6:40 pm


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Zoom Class
Hi! I'm trying to zoom into a map with the Zoom Class in AS3

http://livedocs.adobe.com/flash/9.0/...ions/Zoom.html

But after the button is clicked, my movie clip disappears and zooms from the upper left hand corner and back into stage view as the original size. I'd like to click the button and zoom into my map from the original view. I've tried using scaleX and scaleY, which helps to scale the movie clip, but the entire clip still disappears and then zooms in from the corner. My code is below, thanks in advance for your help

Code:

import fl.transitions.*;
import fl.transitions.easing.*;

mc_wholeMap.btn_SEC.addEventListener(MouseEvent.CLICK, zoomSEC);

function zoomSEC(evt:MouseEvent):void {
mc_wholeMap.scaleX +=0.5;
mc_wholeMap.scaleY +=0.5;
TransitionManager.start(mc_wholeMap, {type:Zoom, direction:Transition.IN, duration:3, easing:Regular.easeInOut});

mc_wholeMap.btn_SEC.visible = !mc_wholeMap.btn_SEC.visible;


}

Tween Class: Zoom And Bounce
Hi, - I need help with getting a series of images to pulse or bounce througout the completion of the background audio. The idea is similar to Adobe's Flash On. You can view at www.developmentspace.net/aspb_revised.html
Everything is working fine but I'd like to have each image to continue to randomly pulse after the animation is complete. The Zoom code makes it completely zoom out and back in. I don't want it to zoom all the way out - only pulse a little. See attached code I used on each image (I'm a beginner so be kind). PLEASE ADVISE REVISED CODE TO GET IMAGES TO CONTINUE TO PULSE. THANKSS!!!!

Attach Code

import mx.transitions.*;
import mx.transitions.easing.*;
TransitionManager.start(ppcov, {type:Zoom, direction:Transition.IN, duration:2, easing:Bounce.easeOut});

Tween Class: Zoom And Bounce
Hi, - I need help with getting a series of images to pulse or bounce througout the completion of the background audio. The idea is similar to Adobe's Flash On. You can view at www.developmentspace.net/aspb_revised.html
Everything is working fine but I'd like to have each image to continue to randomly pulse after the animation is complete. The Zoom code makes it completely zoom out and back in. I don't want it to zoom all the way out - only pulse a little. See attached code I used on each image (I'm a beginner so be kind). PLEASE ADVISE REVISED CODE TO GET IMAGES TO CONTINUE TO PULSE. THANKSS!!!!







Attach Code

import mx.transitions.*;
import mx.transitions.easing.*;
TransitionManager.start(ppcov, {type:Zoom, direction:Transition.IN, duration:2, easing:Bounce.easeOut});

A Simple Zoom From Senoculars Advance Zoom-and-pan Script
Hi guys,

I've tried to modify the zoom script on senoculars website to a total simple zoom function.

http://www.senocular.com/flash/source.php?id=0.76

I want to use the slider, but without the pan-function and zooming in on different places on the main window.

Only thing I need is the slider to zoom in on the center of my main movieclip. I need to have a max. and min. _xscale and _yscale...

Can anybody help me out here... It should be pretty simple, but never used the slider thingy before, so I'm all lost here...

thanks

Zoom Large Image (Stream Enlarge) W/ Pan & Zoom?
I have been scouring google looking for more information on how to zoom large map images with pan functionality.

I found one example of EXACTLY to a T of what I need http://www.veer.com/zoom/

Does anyone know where I can find more information as to the process of loading scaled images on the fly when zooming or what the process is called so I can find the information?

I need to get this working TODAY but have no idea what I am looking for. The map that I am using is quite large, and scale zooming will not do.

Thanks in advance...

Button Mouseover (zoom-in) Mouseout (zoom-out).. How?
OK, here's what I want to do, I have searched and not found anything on it.

OK, I have a button, and when the mouse goes over it, it snaps closer REALLY fast and has kind of a bouncing effect in and out until it finally comes to a complete rest.

Upon mouseout, it should go back to normal size... and before it comes to a stop, it has a little zoom-bouncing effect a well.


Can anyone help me?

Thanks a lot mates!

I Want To Make A Map That Can Be Zoom In , Zoom Out , Drag And When You Click Any Loc
hi .. Anyone ! I have a problem in my Flash Actionscript 1.0 , I want to make a map that can be zoom in , zoom out , drag and when you click any location in the map for example you can see this site.>> click on this link ::

,http://www.enjoyshanghai.com/2007big...id=1&childid=1

Hope you will help me for this, I really appreciate your kindness if you help me. Thank you and God Bless .. Attached file is the zoom.fla samples of my work and i want to be like enjoyshanghai/venue finder map..

Anyone could help...plllzzz

Zoom In And Zoom Out But No Loss In Resolution Of The Image
Hi there,
I am currently in the process of making a flash movie. In the first section of the movie I have three scrollers and there are buttons beside these scrollers to choose which components of the scrollers he/she wants.
Below these scrollers I have a button directing to the next page to see the sum of the three scrollers ie. the final result.
The final result image is rather small and I want to allow the user to see the image in more detail.
I have a zoom piece of code and it doesn't seem to work for me.
Can anyone help me out on this please?
Thanks

Zoom In And Zoom Out But No Loss In Resolution Of The Image
Hi there,
I am currently in the process of making a flash movie. In the first section of the movie I have three scrollers and there are buttons beside these scrollers to choose which components of the scrollers he/she wants.
Below these scrollers I have a button directing to the next page to see the sum of the three scrollers ie. the final result.
The final result image is rather small and I want to allow the user to see the image in more detail.
I have a zoom piece of code and it doesn't seem to work for me.
Can anyone help me out on this please?
Thanks

Zoom In - Repeat/delay Zoom?
I'd like an effect where after my preloader finishes the countdown, a static image which was part of the preloader zooms in to a much larger version.

That, I can do.

But what I am having difficulty doing, without frame by frame animation, is what I *really* want. That is, as it zooms in and slightly moves to the side, an 'echo' image or three are shown in its wake. I hope you know what I mean, since I am unsure how best to describe it. I'll try anyway.

Basically, the main image scales up from 10% to 100%, moving from center to stage left. As it does so, every 5th or 10th frame is frozen for a moment, while the main image continues to scale and slide. This would create an after-effect or 'echo' image just behind the main image.

Any suggestions on how to do this with the least amount of manual work?

Thanks!

Adapting Zoom Code To Use Zoom In And Out
i am using my code at the minute whereby when you click a button it activates a cursor and a function which allows you to click 3 times and with every click it zooms in. but i then want to be able to click a zoom out button which activates a different function whereby you can click 3 times dependant on the state.
below is my code

Quote:




import fl.transitions.Tween;
import fl.transitions.TweenEvent;
import fl.transitions.easing.*;
import fl.motion.MatrixTransformer;
{
const TWEEN_IN:String = "tweenIn";
const TWEEN_IN1:String = "tweenIn1";
const TWEEN_IN2:String = "tweenIn2";
const TWEEN_OUT:String = "tweenOut";
var tweenDirection:String;

var internalPoint:Point;
var externalPoint:Point;
var tw:Tween;
zoomBtn.addEventListener(MouseEvent.CLICK, activateZoomIn);


function activateZoomIn(event:MouseEvent):void
{

mapContainer.insideMap.addEventListener(MouseEvent .CLICK, zoomIn);
mapContainer.insideMap.addEventListener(MouseEvent .MOUSE_MOVE,redrawCursor);

function redrawCursor(event:MouseEvent):void
{
Mouse.hide();
mapContainer.zoomInPointer.x = mapContainer.mouseX;
mapContainer.zoomInPointer.y = mapContainer.mouseY;
}

function zoomIn($e:MouseEvent):void
{
mapContainer.insideMap.addEventListener(MouseEvent .CLICK, zoomIn1);
mapContainer.insideMap.removeEventListener(MouseEv ent.CLICK, zoomIn);

internalPoint = new Point(mapContainer.insideMap.mouseX, mapContainer.insideMap.mouseY);
externalPoint = new Point(mapContainer.insideMap.mouseX, mapContainer.insideMap.mouseY);

tweenDirection = TWEEN_IN;

tw = new Tween(null, "", Strong.easeOut, mapContainer.insideMap.scaleX, 2, 1, true);
tw.addEventListener(TweenEvent.MOTION_CHANGE, _syncScale);
tw.addEventListener(TweenEvent.MOTION_FINISH, _cleanTween);
}
function zoomIn1($e:MouseEvent):void

{
mapContainer.insideMap.addEventListener(MouseEvent .CLICK, zoomIn2);
mapContainer.insideMap.removeEventListener(MouseEv ent.CLICK, zoomIn1);

internalPoint = new Point(mapContainer.insideMap.mouseX, mapContainer.insideMap.mouseY);
externalPoint = new Point(mapContainer.insideMap.mouseX, mapContainer.insideMap.mouseY);

tweenDirection = TWEEN_IN1;

tw = new Tween(null, "", Strong.easeOut, mapContainer.insideMap.scaleX, 3, 1, true);
tw.addEventListener(TweenEvent.MOTION_CHANGE, _syncScale);
tw.addEventListener(TweenEvent.MOTION_FINISH, _cleanTween);
}
function zoomIn2($e:MouseEvent):void
{
mapContainer.insideMap.removeEventListener(MouseEv ent.CLICK, zoomIn2);

internalPoint = new Point(mapContainer.insideMap.mouseX, mapContainer.insideMap.mouseY);
externalPoint = new Point(mapContainer.insideMap.mouseX, mapContainer.insideMap.mouseY);

tweenDirection = TWEEN_IN2;

tw = new Tween(null, "", Strong.easeOut, mapContainer.insideMap.scaleX, 4, 1, true);
tw.addEventListener(TweenEvent.MOTION_CHANGE, _syncScale);
tw.addEventListener(TweenEvent.MOTION_FINISH, _cleanTween);
}


function _syncScale($e:TweenEvent):void
{
mapContainer.insideMap.scaleX = mapContainer.insideMap.scaleY = tw.position;

var matrix:Matrix = mapContainer.insideMap.transform.matrix;

MatrixTransformer.matchInternalPointWithExternal(m atrix, internalPoint, externalPoint);

mapContainer.insideMap.transform.matrix = matrix;
}

function _cleanTween($e:TweenEvent):void
{
tw.removeEventListener(TweenEvent.MOTION_CHANGE, _syncScale);
tw.removeEventListener(TweenEvent.MOTION_FINISH, _cleanTween);

tw = null;

if(tweenDirection == TWEEN_IN)
mapContainer.insideMap.addEventListener(MouseEvent .CLICK, zoomIn1);
if(tweenDirection == TWEEN_IN1)
mapContainer.insideMap.addEventListener(MouseEvent .CLICK,zoomIn2);
else if(tweenDirection == TWEEN_OUT)
mapContainer.insideMap.addEventListener(MouseEvent .CLICK, zoomIn);
}

Zoom In Zoom Out Double Click
Hi guys!, I need help, I have this code that allows you to zoom in and out of any flash clip by double clicking on the screen. It works nicely, however I would like to be able to move around by using the mouse once I am zoomed in, I can do it by double clicking again zooming out and double clicking once more to zoom into a different area, but this gets quite tedious.

the code is the following:

onClipEvent (load) {var clickInt;
var pressed = 0;
function doSingle(mc) {
clearInterval(clickInt);
pressed = 0;
trace("single");
}
myZoom = function (myDepth) {
var k = 0;
var zoom = false;
if (myDepth == "deep") {
myDepth = 4;
} else if (myDepth == "medium") {
myDepth = 8;
} else if (myDepth == "light") {
myDepth = 12;
}
trace(myDepth);
_root.onMouseDown = function() {
pressed++;
if (pressed == 1) {
clickInt = setInterval(doSingle, 300, this);
} else {
clearInterval(clickInt);
pressed = 0;
trace("double");
if (k > 0) {
return;
}
zoom = true;
dir == 1 ? (dir = -1) : (dir = 1);
if (dir == 1) {
pt = {x:_root._xmouse, y:_root._ymouse};
}
}
};
this.onEnterFrame = function() {
if (!zoom) {
return;
}
_root._xscale += dir * k * 50 / myDepth;
_root._yscale += dir * k * 50 / myDepth;
var pt2 = {xt.x, yt.y};
_root.localToGlobal(pt2);
_root._x -= (pt2.x - pt.x);
_root._y -= (pt2.y - pt.y);
k++;
if (k == 8) {
zoom = false;
k = 0;
}
};
};
myZoom("medium");
}

[F8] Image Viewer And Zoom In & Zoom Out
hi friends,
I have attached two attachments with this.
My Query is.

There are nine images are equally displayed. On mouseover on an image The image will be Zoom Out and and displayed in the page center . The background images are diminished or a black color mask will be appear.

I want to done it in the flash If anyone done such thing. give ur views.how to do.

I want your suggestions and Thanks in advance.,

Zoom In Zoom Out With Mouse And Keyboard
is all about gain speed i forgot how to zoom with the keyboard and mouse. how do i zoom with the mouse and keyboard?

Zoom In-Zoom Out World Map By ActionScript
i m trying to make a Zoom In-Zoom Out a world map.What i want when i click on 1 particular part(country) at that time that part(country) will be zoom in,and after that when i click on a samepart(part which is zoom in),at that time its will be zoom out(at original size). is is possible by actionscript? if yes plz,How?plz tell me in details....


Thank u.

Move & Zoom In, But Wont Zoom Out. - HELP PLEASE
I have 2 scripts, that by themselves work just fine.
The first upon clicking moves items to the correct location.
the second zooms the final item in - action script to 300%. when another button is pushed that item is zoomed back out.
when they are combined for some reason the zoomItem holds the script from zoomIn and uses the settings for zoomOut, but does not zoomOut. It loops back to the zoomIn script. Can anyone see where these scipts are fighting?

Move & Zoom In, But Wont Zoom Out. - HELP PLEASE
I have 2 scripts, that by themselves work just fine.
The first upon clicking moves items to the correct location.
the second zooms the final item in - action script to 300%. when another button is pushed that item is zoomed back out.
when they are combined for some reason the zoomItem holds the script from zoomIn and uses the settings for zoomOut, but does not zoomOut. It loops back to the zoomIn script. Can anyone see where these scipts are fighting?
It appears that the move and then zoom in loops. The zoom in occrus and then for soem odd reason loops back to the start of the move sequence, but since the action is completed it moves to the zoom in.. which is why the zoom out only briefly works.. it zooms out a bit then loops back the the move script then to the zoom in script, which zooms it back to 300%. I have tried settin up catches and set varibles, but nothing seems to release it.

Zoom In Zoom Out For An External Swf Movie
Hi all,

Just wondering if anybody has done a zoom in and zoom out, as well as panning left to right using the mouse, for another movie (swf) which is loaded externaly. This can be simulated by right-clicking on any swf file, and clicking on the ZOOM IN button, after which the user can drag the entire page of the swf movie. Just wondering if this could be one. I've checked the forum, but I can't find anyhting relevant to my query. Might be 'cause I don't know which key word to use, haha. Thanks again1

Remove The 'zoom In' 'zoom Out' Options
hello, my question is, when I click on the right mouse button, it shows me 3 options

"zoom in" "zoom out" "show all"

I saw in few sites that they remove it... how can I do it?


thanks... =]

Zoom In Zoom Out For An External Swf Movie
Hi all,

Just wondering if anybody has done a zoom in and zoom out, as well as panning left to right using the mouse, for another movie (swf) which is loaded externaly. This can be simulated by right-clicking on any swf file, and clicking on the ZOOM IN button, after which the user can drag the entire page of the swf movie. Just wondering if this could be one. I've checked the forum, but I can't find anyhting relevant to my query. Might be 'cause I don't know which key word to use, haha. Thanks again1

Zoom In Zoom Out Script For Vector.
Hi Peeps,

I have created an enterframe script to tween a movie clip.  The tween changes the _xscale/_yscale values (uniformly), and the _x and _y positions.

The script will increase the scale and move the x and y positions in one direction, but when i want it to decrease the scale back down again, or move x and y in the other direction, it wont work.  Does it have something to do with the else if statement i have included to move the increment in the opposite direction?

Here is the code, its a bit of a dogs breakfast.


onClipEvent(enterFrame){

    /*use an if statement to get an update sprite on each enterFrame, as a while or for statments never
    refresh the stage until the condition is met.*/
    
    if(z==1){

        //create decrementing values passed from the unique values in each button.
        trace(fridgeScale);
        scaleSpeed= Math.abs((fridgeScale - _xscale)/5); //(scale / 5 iterations.)
        trace("Current scaleSpeed interation value = " + scaleSpeed);
        posSpeedX = Math.abs((newX - _x)/5); //(distance / 5 iterations.)
        trace("Current posSpeedX interation value = " + posSpeedX);
        posSpeedY = Math.abs((newY - _Y)/5); //(distance / 5 iterations.)
        trace("Current posSpeedY interation value = " + posSpeedY);
        

        //if statement to make sure the iterations of scaleSpeed, posSpeedX and posSpeedY dont get too small.
        
        if(scaleSpeed <= 2){
            scaleSpeed=2;
            
            trace("ScaleSpeed got too small so i made it = " + scaleSpeed)
        }
        if(posSpeedX <= 2){
            posSpeedX = 2;
            
            trace("posSpeedX got too small so i made it = " + posSpeedX)
        }
        if(posSpeedY <= 2){
            posSpeedY = 2;
            
            trace("posSpeedY got too small so i made it = " + posSpeedY)
        }

        
        //adds the scaleSpeed increment to the movieClip, until it reaches desired scale(fridgeScale)
        if (_xscale < fridgeScale) {
            trace("Current Scale size = "+_xscale);
            _xscale+=scaleSpeed;
            _yscale+=scaleSpeed;
        }else if (_xscale > fridgeScale) { //scales Down the size of the fridge mc.
            trace("Current Scale size = "+_xscale);
            _xscale-=scaleSpeed;
            _yscale-scaleSpeed;
        }
        
        //subtracts the posSpeedX increment to the movieClip, until it reaches desired x pos(newX)
        if(newX<_x){
            _x-=posSpeedX;
        }else if(newX>_x){ //move y postion of the movie clip in the opposite direction.
            _x+=posSpeedX;
        }

        //subtracts the posSpeedY increment to the movieClip, until it reaches desired y pos(newY)
        if(newY<_y){
            _y-=posSpeedY;
        }else if (newY>_y){//move y postion of the movie clip in the opposite direction
            _y+=posSpeedY;
        }
        
        //enter this statment when the scale and x, y position has finished.
        if(_xscale >= fridgeScale){
            trace("Final Scale size = " + _xscale);
            trace("Final x pos = " + _x);
            trace("Final y pos = " + _y);
            z = 0
        }
    }//end z = 1 statement.
}

Basically each time it enters the frame the increments(scaleSpeed, posSpeedX, posSpeedY) get smaller, to give an 'ease in' effect to the tween, and when the scale has been reached, it stops. Although to stop the increments getting too small i have implemented if statments that keep the iterations at a minimum value of 2.

What is it I need to move the scale in the opposite direction? if the new scale size(fridgeScale) is less than the current scale value, as well as move to new x,y locations (newX and newY) and if they are greater than the current positions?  the else if part of my code dont seem to cut it! :)

The code that moves between the newX and _x positions may look incorrect, but this is because the x and y positions move into negitive numbers.

Cheers
Paul.


[Help]: Help Needed Creating A Zoom Menu Like Flashloaded's Zoom Menu
Hi,
Can someone please tell me how to create a zoom menu such as the one offered by Flash Loaded -
http://www.flashloaded.com/zoommenu.php
Or does anyone have any similar menu ideas?
Also, instead of keeping it as squares, is it possible to make it circles.
Looking forward to hearing from someone at the earliest.
Thanks in advance.

Zoom In - Zoom Out - Show All
What is it that makes a flash movie (when right clicked) show the menu items Zoom In - Zoom Out etc. And what makes it only show Settings/About Macromedia Flash Player?

Zoom In Zoom Out Navigation
Hi all, Im tryin to put together a navigation for my page.
I have a very wide and high page, and I want it to scroll nicely
to different parts of the page when different buttons are pressed.
Ive seen a tutorial on a navigation said to be like the one on LEnny Kravitz's site or somffin, where it zooms out and then in on the right section....anyone know where this tut is??

Or can help in some other way??

Zoom In / Zoom Out In Movie
Does anyone know how to make this effect in our animation?

Thanks

How Can I Do Zoom In And Zoom Out With Mouse?
Hello Dear Friends,
hi,
Dear there is a web site
http://www.amplifier.com/

here he has used a very good navigation.
When we click on (+) button it zoom in and when we click
on (-) button it zoom out.
and there is also a smoothness when we click on any button.
it move smoothly.
it is not only on website that have used this type of navigation, there is a lot of websites now a days that have used this type of.....
i have searched a lot of, but i can't get any help?

I want to know how it is possible to do this to zoom in or zoom out with mouse.
If someone have a link or tutorial or and suggestions
then please tell me i shall be very thankful to you for this
purpose.

Your Sincerely,
Amir

Map Zoom Tool Does Not Zoom In...
I have a main "main-menu.swf"
I'm loading "map1.swf" in main-menu
I'm also loading "nslidebar.swf"

"nslidebar.swf" does not control the map when in "main-menu"

It only controls the map if I launch "map1.swf"

What can I do to use the zoom control in "main-menu"?
Downlaod Here

How To Do Zoom In/Zoom Out Like Matthewmahon.com
Does anyone know how these sites were developed. Any .FLA out there??

matthewmahon.com
http://www.bbdo.com
http://www.saturday-london.com

Any help would be appreciated.

HH

Zoom In On .swf If Zoom Is Disabled
There's an .swf file that I want to be able to zoom in on, but the "Zoom" option is disabled. Is there a hack, say for Firefox, or a stand alone program that will enable the zoom feature in the Flash player?

Thanks!

Zoom In And Zoom Out Function
hi all,

i was a following code which include a moive clip called photo and two buttons:

if i click the two buttons , it always enlarge the photo about 0,0 .
any suggestion to enlarge the photo about the center point of the stage?







Attach Code

photo._x=0 ;
photo._y=0;

photo.onPress = function() {
this.startDrag();
};
photo.onRelease = function() {
this.stopDrag();
};

incr_btn.onRelease=function(){

photo._xscale=photo._xscale+2;
photo._yscale=photo._yscale+2;


}


decr_btn.onRelease=function(){

photo._xscale=photo._xscale-2;
photo._yscale=photo._yscale-2;


}

Zoom In Zoom Out Images Through Xml
Hi All,

Can anyone give me idea to zoom in and zoom out images through xml , I have seen quite a few examples but in all there are images embeded in flash

Wht i am looking for images will be in xml file.........and the component of zoom in and zoom out will with be in flash.........

any suggestions,,,,,,,,,,will be of great help,

Thank You

Rohit Yog

How Do You Turn Off Zoom In/zoom Out?
How do you turn off zoom in/zoom out on a flash site like when you right click you don't have the option to zoom in or out.

examples: www.nt-sky.com, www.2advanced.com

Button: Zoom In Mouse Over, Zoom Out Mouse Out? (noob)
Please humour my ineptitude here. I want to make buttons that "zoom in" or scale up upon mouseover, depress on click and zoom out on mouse out. I figure I need a script for this withe on mouse over go to frame # whatever, but i dont fully understand the functions and commands of MX. Please would someone run me through what I would need to do to create this effect?

Calling A Function In Main Class From A Loaded Swfs Document Class
Hi
I have a main.swf that loads page.swf. They each have a document class called "Main" and "Page".

How can I call a function in Main from Page?

In AS2 this would be somthing like _parent.myFunction();


Cheers

Class Question: How To Access Timeline Objects From Class W/o Arguments
Hey all,

I am looking into builiding an application with OO functionality. I understand most of it. Except I cannot figure out how to access something in my app from a class. For instance, lets say I have one Loader class that loads some data and stores it in a variable inside the class (or on the main timeline, doesn't matter). Now, I know I can pass a reference to the data in an argument to another class for that class to manipulate. But if I have several data sources, and other variables and such, that I need to modify in a single class function, how would I do that without having to give the function access to them through arguments? I just want to be able to say, from a class, something like _root.someObject.someFunction();

So, any help would be greatly appreciated, and sorry if that made no sense at all, I tried to explain as best I could.

Happy Holidays!
Dave

[Flash 8] Referencing Class Variables From OnEnterFrame Created Within Class
Hi,
It's been a while since my last post here, but I was hoping someone could help me with a problem I'm having. I want to reference and change a class variable from within an onEnterframe function defined within a class. I can actually do this right now, but I want to do it in a different way. Here's a code sample of what I am talking about:


Test.fla file:

Code:
var t:tester = new tester()

Working tester.as file:


Code:
class tester{
private var num:Number = 100;

function tester(){
var classObj:tester = this;
var mc:MovieClip = _root.createEmptyMovieClip("test",1);
mc.onEnterFrame = function(){
trace(classObj.num); //This traces 100 (CORRECT!!!)
}
}
}
This traces 100 to the output window, just like it should

Here is the way that I would like to do it, because I want to reuse my onEnterFrame Stuff:

Code:
class tester{
private var num:Number = 100;

function tester(){
var classObj:tester = this;
var mc:MovieClip = _root.createEmptyMovieClip("test",1);
mc.onEnterFrame = this.mcOnEnterFrame;
}

private function mcOnEnterFrame(){
trace(num) //this traces undefined (BAD!!!)
}
}

As you can see, the work around to reading the class variable in the onEnterFrame function is to create a reference to the class object, before defining that function, then using the reference you created to access the class variables.

I have tried various iterations to get the second example working, but have had no luck. Does anyone know a way to get the second method working, or am I stuck using the first method.

AS3 Project In FDT + Flex SDK. Root Class Extends Visual Class From Swc
hello
question about compiling as3 project under FDT 3.0 with Flex SDK.

I want my main root class to contain some graphics already at the start. In Flash IDE I put some objects on the stage, make new symbol with all those objects inside, set linkage to MainClassGraphics, export it to swc, add this swc to source folder class-path. Then I write my root class:

Code:
package {

public class MainClass extends MainClassGraphics {
public function MainClass() {
trace('hey');
}
}
}

compiling with flex2 sdk - and I don't see any graphics. why?

if i try this way:

Code:
package {
import flash.display.Sprite;

public class MainClass extends Sprite {
public function MainClass() {
var s:Sprite = new MainClassGraphics();
addChild(s);
trace('hey');
}
}
}

then I see my graphics.. so swc looks like fine


crosspost here http://fdt.powerflasher.com/forum/vi...hp?f=21&t=2268

Accessing A Dynamic Text Field In A Class Other Than The Primary Class
I have tried to read and understand some of the other threads for this issue but, I think it would be easier to understand if I show my specific issue. I left some code out to make my issue more clear.

Alpha is the primary class with access to the stage. If I write the event listener and function contained in the Bravo function into the Alpha function it works. Although, I want it to be in a different class in the same package (such as the Bravo class).

I have created a instance of a class which is a physical object on the stage (lets say it's a card). The event listener is in the instance so that each instance has a self contained listener.

The bottom line is it works in the primary class but in no others. How can I make it access the text field (so when I click on the "card" the text field shows "something"?


ActionScript Code:
package a {
     public class Alpha {
          public function Alpha() {
               x:Bravo = new Bravo();
          }
     }
}

package a {
     public class Bravo {
          public function Bravo() {
               this.addEventListener(MouseEvent:CLICK, clickEvt);

               function clickEvt(event:MouseEvent) {
                    <MovieClip>.<MovieClip>.<DynamicTextField>.text = "something";
               }
          }
     }
}

Calling SetTimeout Within Custom Class And Cannot Access The Class' Variables
Hi All,

I'm creating an user interface with Flash 8, I'm new to Flash, my background is Java therefore I decided to use ActionScript to create a custom component that is reference within an external file.

My problem I believe is scope related. I have a status bar (label component), once I update the status bar I want to call the
"setTimeout" function to wait a couple of seconds before clearing my status bar. The "setTimeout" function is executing, but for some reason my status bar is not being cleared (accessed).

Below is a snippet of my code. Any help appreciated. Thanks.


/*
External File
*/
import mx.controls.Button;
import mx.controls.Label;

class MyApp
{
//private properties
private var mc_container:MovieClip;
private var btn:Button;
private var lbl_status:Label;
private var str:String = "do see me";

//constructor
public function MyApp(target:MovieClip)
{
trace("-- MyApp --");
mc_container = target.createEmptyMovieClip("mc_container", 100);
}
//public methods
public function init(width:Number, height: Number, xPos:Number, yPos:Number):Void
{
var my_app:MyApp = this;

btn = mc_container.createClassObject(Button, "btn", 1, {label:"click me"});
btn.setSize(100, 25);
btn.move(10, 10);
btn.clickHandler = function():Void
{
trace("btn clicked");
setTimeout(my_app.clearStatus, 2400);
//correct if I call directly
//my_app.clearStatus();
trace(str);
}

lbl_status = mc_container.createClassObject(Label, "lbl_status", 2, {text:"status bar message"});
lbl_status.setSize(200, 25);
lbl_status.move(0, 50);
}
public function clearStatus():Void
{
trace("calling clearStatus");
lbl_status.text = "";
}
}


/*
Called for Flash IDE
*/
var app:MyApp = new MyApp(this);
app.init(200, 200, 0, 0);

ActionScript 2.0 Class Scripts May Only Define Class Or Interface Constructs.
This is driving me nuts. I have an old AS1 project which I upgraded to AS2. It uses an include file, settings.as, which has stuff like this:
settings = new Object();
settings.property = 'some value';

Then I include it on the main timeline like this:
#include "settings.as"

Every time I render, I get a million and one Compile Errors stating:
"ActionScript 2.0 class scripts may only define class or interface constructs."

But it isn't an ActionScript 2.0 class! It's just a regular include. How do I avoid the bogus Compile Errors?

AddChild Works With Document Class, But Not Timeline-instantiated Class
I cannot get a sprite to display for me when I create an instance of a very simple class in my FLA file's timeline.
However, when I make the class file the FLA's document class file, it displays just fine.
The task in question is simply drawing a square with the shape class.

Problem example:
My class, Test.as, resides in the same folder as my FLA file - so I don't use any import statement. I'm new to lots of CS3 stuff. Can anyone tell me why this doesn't work and create the shape on the stage? This seems to fail silently without any errors:
var myTest:Test = new Test();

Working example:
Setting the document class to Test.










Attach Code

// Test class

package {
import flash.display.*;

public class Test extends Sprite {

public function Test():void{
doThing();
}

private function doThing():void{
var myRect:Shape = new Shape();
myRect.graphics.lineStyle (2, 0xcc0000, 1);
myRect.graphics.beginFill(0xcccccc, 1);
myRect.graphics.drawRect(10, 10, 200, 200);
addChild(myRect);
}
}
}

[AS3] Making An Auto-generated Class Inherit From Custom Class?
hi, just wondering if this is possible

i was hoping to find a way to get a bunch of objects in my library to inherit from (or even be) one class that i have made, but without having to make .as files for every single one

is this possible, or is there any other way to give objects another classes functionality in an auto-generated class?

cheers

Tough One: Accessing Class Methodes From Other Class Files
Tough question for the experts...

In my classfile class Classes.tools.depthManager, I've got a static methode


Code:
public static function getLoopDepth():Number {
In another classfile Classes.tools.frameRateViewer, I want to access that methode


Code:
var tempDepth = Classes.tools.depthManager.getLoopDepth();
The compiler claims: "There is no class or package with the name 'Classes.tools.depthManager' found in package 'Classes.tools'."

So I tried writing import Classes.tools.* at the top of my Classes.tools.frameRateViewer.as, hoping I could just write


Code:
var tempDepth =depthManager.getLoopDepth();
But there the compiler claims: "The class being compiled, 'Classes.tools.depthManager', does not match the class that was imported, 'depthManager'."

I'm sure the Classes.tools.depthManager.as works fine: I can call the static depthManager.getLoopDepth() from a button in the fla file...

Any ideas? Thanks!

Window Class Attach Scrollbar/Pane Class?
I am using MX 2004 Prof...

Is there a way to attach a scrollbar/pane to the body of a Window class to make the content scroll?

Button Created Within Class Cannot Access Class Properties
Hi,
I'm using the following code within a class:
code:
_head_mc.attachMovie("headButton", "head_btn", this.getNextHighestDepth());

_head_mc.head_btn.onRelease = function () {
containingClip_mc._parent._parent.clickedHead(_per sonName);
}


The button gets attached (line 1). This works because I can see the mouse changing to a finger.

The onRelease function is declared and works. I know because if I put a trace in there, it works.

The function it calls (containingClip_mc._parent._parent.clickedHead also works, becuase I can see traces from within it.

But the _personName variable is passed as undefined.

I know that this variable has a value, because I can trace it outside the function, but it seems that this onRelease function is not able to see the variable. It's declared as private, but setting it to public doesn't fix anything.

I imagine there's something I don't understand about the scoping of variables. I've tried _parent references, but that doesn't appear to help either. Is there a better way to do this or a workaround?

Barrette

Added by edit
Okay, I've pretty much determined this is a scoping issue. From the onRelease function, I'm unable to access ANY of the functions within my class. I still would like advice on how to do so..

Barrette

[Flash8] Calling BitmapData Class From Within Custom Class
I've written a custom class which resides in a .as file. Is there any way that functions from within my class can call the BitmapData class for bitmap manipulation?

**Error** ActionScript 2.0 Class Scripts May Only Define Class........
**Error** ActionScript 2.0 class scripts may only define class or interface constructs.
b2.onPress = function() {

**Error** ActionScript 2.0 class scripts may only define class or interface constructs.
b3.onPress = function() {

**Error** ActionScript 2.0 class scripts may only define class or interface constructs.
b4.onPress = function() {

ok this is what i have.

1 Movie clip with links to a .as file all is working fine the above error occurs when i publish the 1 movie clip which is getting pulled into the main movie

Any idea's it does not happen when 1 movie clip is published on its own just when 1 move clip is pulled into my main movie clip.

[F8] Referencing A Static Class Inside Another Class's Instance
I've got a movie loading into a framework.

This framework has 1 instance of the class main called main.

Inside this class, another class is used, but it is used directly, not as an instance. E.g.:
code:
import com.StaticClass;
class main {
private function UseStaticClass():void {
StaticClass.init();
}
}


From my movie, I can reference the main instance as _root.main. Can I reference StaticClass at all if there's no explicit instance created or it's not assigned to a public variable?

I can't modify main to include getter/setter methods, that's why I ask.

Thanks.

Child Class Trigger Event For Parent Class
is there a way for a parent class to listen to a variable in a subclass, and when it changes, run a function?

This seems like a pretty simple thing to do. I'm trying to keep my subclass independent of my main class, so i just have a variable that is set to false, and when its finished, it sets the variable to true.

The only thing i can think of is having an onEnterFrame that keeps checking the variable...but it seems like an event would be more efficient.

thanks!

Copyright © 2005-08 www.BigResource.com, All rights reserved