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




Help Referencing Stage Elements



How do I go about referencing an element on the stage such as a Movie Clip from within a custom class that doesn't extend the movie clip itself.For example if I have the following document class...Code: package classes{   import flash.display.MovieClip;   import classes.XMLLoader;      public class DocumentClass extends MovieClip   {      public function DocumentClass():void      {          var xml:XMLLoader = new XMLLoader();      }   }}and this is my XMLLoader class...Code: package classes{    import flash.events.*;    import flash.net.URLLoader;    import flash.net.URLRequest;       public class XMLLoader    {        var req:URLRequest = new URLRequest("myXML.xml");        var loader:URLLoader = new URLLoader();              public function XMLLoader():void        {             loader.addEventListener(ProgressEvent.PROGRESS, loadProgress);             loader.addEventListener(Event.COMPLETE, loadComplete);             loader.load(req);        }                private function loadProgress(event:ProgressEvent):void        {             var percent:Number = ( 100 / event.bytesTotal ) * event.bytesLoaded;        }        private function loadComplete(event:Event):void        {             var newLoader:URLLoader = URLLoader(event.target);        }    }}If I have a dynamic text box with the instance name xml_txt inside a movie clip with the instance name xml_movie on the stage, how can I access it from within the XMLLoader class?



Actionscript 3.0
Posted on: Wed Jul 23, 2008 3:58 pm


View Complete Forum Thread with Replies

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

Referencing Button Elements.
How can I reference elements inside a button through actionscript? Do I have to specifically reference a up/over/down/hit frame?

I am trying to change the size of the hit area at runtime. I have a movie clip in the hit frame (actually stretched across all four frames) that keeps coming back as 'undefined', although I can reference the button itself with no problem.

Why Am I Seeing Elements Off Stage?
Hi

I am confused. I just started working with Flash again after some time away, and a most basic thing is not working for me. I am using MX.

If I make the simplest animation, say a square motion-tweened so that it comes from off-stage and onto the stage... when I publish or publish preview, I can see the object when it is off the stage. In fact, I can put any number of objects off the stage and lo and behold, they are visible when I publish.

What gives? I have read some threads saying to put a mask above all the other layers. Is that the only way? That seems counter-intuitive. I mean, why have a stage area at all if you can see the objects off-stage. Is there a setting, a Publish setting or SOMETHING that I am missing here?  Please Help!

THANKS!

RR

Elements On The Stage....
I can't figure this out...

I'm doing a full browser flash site. I want a black band to run across the bottom and stretch the width of the browser. I don't want the height to ever change... could this be done in Flash? or do I need to use css or frames in my html?

thanks
ds

No Scale Stage Elements
Hello,

I know how to do the no scale stage thing for a movie clip in the center of the page, but how do you do this for the elements that sit on the edges of the page? I would like these movie clips to hug the side of the window and adjust (but not scale) when the browser window is resized.

Here is a good example of what I am talking about.... http://www.drawingart.org/#/home

I would really appreciate your help

Thank you

Kit Wilkins

Displaying Elements Off-Stage?
We've all seen those Flash "pop-up" ads - the Flash documents that display over other rendered HTML content instead of in a new window. Can anyone point me to any tutorials showing how they do it? I'm working on an animation where I want just a few pixels of certain elements to overlap HTML content outside of the stage to create more of a blend between site elements. Any help would be appreciated.

Thanks!
-Nate

I Just Don't Get It, Accessing Elements On The Stage.
So I've been banging my head on the wall, I'm trying to access items on the stage and for some reason I can't from my external AS files. I'm including my AS and FLA files so you can see exactly what I'm doing. In this example I have a simple button that I supposed to update the text in a text box. I have my package and class defined, as well as my function.

AHHHHH please help this is driving me nuts. I know this is going to be something simple but I'm kind of new to AS syntax.

Thanks = )
Steve

Placing Elements On Fullscreen Stage
Hi;
i managed to make my movie full screen, but it scales all elements in the movie, can i control some element like the menu not to scale?

Elements From Stage Disappear When Previewing
I have a very simple graphical effect using a mask and some text. It looks great on the stage but disappears when I preview or publish.

Can anyone tell me what I might be doing wrong?

Thanks.

Aligning Stage Elements To 0, 0 In Browser
Hi all,

I'm currently developing a site who's stage dimensions are 750 x 575. The swf sites in the middle of the browser window, and is set Stage.scaleMode = "noScale"; This is all well and good, as the none scaled stage is meant to sit in the middle of the browser but allow off screen elements to be shown off stage. ie. the swf scrolls about all over the place. But because the swf is centred in the browser window, it is still referencing 0, 0 as being where the swf is actually situated. I need to add a footer, that goes completely across the width of the browser, and am having problems trying to align the footer to the left of the browser.

Any ideas?

Aligning Stage Elements To 0, 0 In Browser
Hi all,

I'm currently developing a site who's stage dimensions are 750 x 575. The swf sits in the middle of the browser window, and is set Stage.scaleMode = "noScale", with the swf dimensions set to 100% in the html. This is all well and good, as the non-scaled stage is meant to sit in the middle of the browser but allow off screen elements to be shown off stage. ie. the swf scrolls about all over the place. But because the swf is centred in the browser window, it is still referencing 0, 0 as being where the swf is actually situated. I need to add a footer, that goes completely across the width of the browser, and am having problems trying to align the footer to the left of the browser.

Any ideas?

How Do I Select And Move All Elements On The Stage?
I know this is probably easy to someone but I have spent too much time on it so I give up. Can someone tell me how to select all the elements in every frame on the stage and simply move it up? Appreciate any feedback!

AttachMovie Below Stage Elements On Timeline?
I did some searching and it looks like elements that are on the timeline are added at the lowest possible depth first and in increasing order. I want to attach a movie clip, but I want it to be behind elements that are on the timeline. How can I do that if timeline elements are already as low as they can go?

Remove Array Elements From Stage
Hey Guys and Gals. I have the following code that duplicates a movie clip on my stage. At the end of my web banner I am having trouble making the movie clips disappear. It's an online banner so when the banner loops I don't want the duplicated clips to stay on the stage I just want them to clear off and have it start from scratch again. I've tried popping them through a function and the removeChild statement. Just stuck at the moment. Thanks!

//This array will hold all the rectangles on the stage
var rectangles:Array = new Array();


//In this loop, we'll create 50 rectangles
for (var i = 0; i < 25; i++) {

//Create one rectangle
var rectangle:Rectangle = new Rectangle();

//Assign a random position
rectangle.x = 15;
rectangle.y = 85;

//Add the rectangle on to the stage
addChild (rectangle);

//Add the rectangle to the array
rectangles.push (rectangle);

}

//The timer will call the "shakeRectangles" function every 0.02 seconds
var timer:Timer = new Timer(20, 100000000);
timer.addEventListener (TimerEvent.TIMER, shakeRectangles);
timer.start ();

//This function is responsible for animating the shake
function shakeRectangles (e:Event):void {

//Loop through the array
for (var i = 0; i < 25; i++) {

//Rotate the rectangle a random amount (from -4 to 4)
rectangles[i].rotation += Math.random() * 1 - 0.5;

//Assign a new random position
rectangles[i].x += Math.random() * 2 - 1;
rectangles[i].y += Math.random() * 2 - 1;
}
}

SWF File Playing Elements Outside Of Stage Area
I have a movie thats 700x468, When put in an html doc and loaded you can see pictures scrolling in outside of the stage area. What settings do I need to modify or change?

Any help would be appreciated.

Combo Box Component Beneath Stage Elements
I am using this code to attach a combo box component to the stage.

var honorComboBox:ComboBox = attachMovie("ComboBox", "honorComboNew", this.getNextHighestDepth());
honorComboBox._x = 400;
honorComboBox._y = 155;
honorComboBox.setSize(270);

The problem is that I have four combo boxes stacked slightly above one another. When I select one of them, say the topmost one, it goes beneath the others. I have tried specifying a depth, but that did not fix it.

Please help.

Sometimes Elements Of A Flash Movie Don't Load On Stage
occasionally, publishing and playing in flash 8, i'll look at my site in a browser and a certain visual element does not load. as soon as i refresh the page it is there though.

i'm using a typical preloader and then the movie is there; no xml or streaming components, just basic flash. for example, i'll have a movie that has a movieclip in it that has, lets say, a picture of a truck with a drop shadow underneath that are 2 seperate graphic elements. sometimes the drop shadow is there but not the truck. i'll have another movie with another movieclip in it, all on the stage, not attached or anything and sometimes it doesn't load. i'll refresh and it's there. just one preloader for the entire movie.

anyone else ever have this happen or does anyone know why this might be happening? thanks for your time.

Position Elements With Stage Co-ordinates When Inside A MC
Hi... I am trying to dynamically set position on certain movie clips, which is normally fine.

However is it possible to set the position relative to the stage rather than the movie clip its in? So set the x + y co-ordinates relative to the stage?

Thanks for any help in advance.

Scott

Assigning Array Elements To Objects On Stage
I have built an array of colors that I want to assign to clips on stage but there is something missing in a script and I'm stuck:

ActionScript Code:
//create a script assigning RGB color to a clipfunction combineRGB (red, green, blue) {    //combine the color values into a single number    var RGB = (red << 16) | (green << 8) | blue;    return RGB;}MovieClip.prototype.setRGB = function (colorValue) {    new Color (this).setRGB (colorValue);};//set color valuescolor1 = combineRGB (76, 98, 139);color2 = combineRGB (124, 54, 52);color3 = combineRGB (92, 92, 118);color4 = combineRGB (119, 91, 80);//declare a new Array: "colors" for retrieving values latercolors = new Array ();for (i = 1; i < 4; i++) {    colors[i] = ["color" + i];    //trace (colors[i]);//the following should(?) assign color[i] to box[i] (boxes are objects on stage)    this["box" + i + "_mc"].setRGB (colors[i]);}


I can assign one of the colors to all the boxes and it works:
this["box" + i + "_mc"].setRGB (color5);
but that's not quite the effect I'm looking for

Accessing Elements On The Stage From A Linked Class
I'm trying to link a clip to a class, and it goes well until I try to access MovieClips or TextFields placed on the stage within that clip from code in the class. My code is below; there is a TextField called output_txt on the stage within this clip.

Any help is much appreciated.
Dave


class Main extends MovieClip{
public function Main() {
//trace("123"); <--if I replace the line below with this, it traces nicely
output_txt.text = "123";
stop();
}
}

Particle Effect Layer Behind Other Elements On Stage
Hi!!!

I am using a particle effect code (as3) I got from a tutorial... but I do not know how to place it behind other objects on stage. Is there any way?

Thanks!

Assigning Array Elements To Objects On Stage
I have built an array of colors that I want to assign to clips on stage but there is something missing in a script and I'm stuck:

ActionScript Code:
//create a script assigning RGB color to a clipfunction combineRGB (red, green, blue) {    //combine the color values into a single number    var RGB = (red << 16) | (green << 8) | blue;    return RGB;}MovieClip.prototype.setRGB = function (colorValue) {    new Color (this).setRGB (colorValue);};//set color valuescolor1 = combineRGB (76, 98, 139);color2 = combineRGB (124, 54, 52);color3 = combineRGB (92, 92, 118);color4 = combineRGB (119, 91, 80);//declare a new Array: "colors" for retrieving values latercolors = new Array ();for (i = 1; i < 4; i++) {    colors[i] = ["color" + i];    //trace (colors[i]);//the following should(?) assign color[i] to box[i] (boxes are objects on stage)    this["box" + i + "_mc"].setRGB (colors[i]);}


I can assign one of the colors to all the boxes and it works:
this["box" + i + "_mc"].setRGB (color5);
but that's not quite the effect I'm looking for

Assigning Array Elements To Objects On Stage
I have built an array of colors that I want to assign to clips on stage but there is something missing in a script and I'm stuck:

ActionScript Code:
//create a script assigning RGB color to a clip
function combineRGB (red, green, blue) {
    //combine the color values into a single number
    var RGB = (red << 16) | (green << 8) | blue;
    return RGB;
}
MovieClip.prototype.setRGB = function (colorValue) {
    new Color (this).setRGB (colorValue);
};
//set color values
color1 = combineRGB (76, 98, 139);
color2 = combineRGB (124, 54, 52);
color3 = combineRGB (92, 92, 118);
color4 = combineRGB (119, 91, 80);
//declare a new Array: "colors" for retrieving values later
colors = new Array ();
for (i = 1; i < 4; i++) {
    colors[i] = ["color" + i];
    //trace (colors[i]);
//the following should(?) assign color[i] to box[i] (boxes are objects on stage)
    this["box" + i + "_mc"].setRGB (colors[i]);
}


I can assign one of the colors to all the boxes and it works:
this["box" + i + "_mc"].setRGB (color5);
but that's not quite the effect I'm looking for :{

Referencing Stage From Class
Hello,
I am trying to make my first as3 class based game and so i was wondering if i could get some help. although the game wont have fancy graphics, i just would like to understand the way it works...currently, i am at a point where im getting :

1067: Implicit coercion of a value of type flash.display:Stage to an unrelated type Stage.
in my main file robot.fla, im using

var robo:robot=new robot(stage);
//var starenemy:enemy1=new enemy1(this.stage);
addChild(robo);

inside that robot.as
....
public class robot extends Sprite {
import flash.display.Stage;
private var _stage:Stage;
....
public function robot(stageRef:Stage):void {
_stage = stageRef;
...
}
amongst other things and i cant reference anything from the stage.

I think im going nuts trying to figure out how to correctly reference things to the stage. so can you take a look and guide me and tell me how i can proceed?
Attached is the zip file

Referencing A MovieClip On Stage Through XML
Hello.

I have a swf with several MovieClip instances on the stage at authoring time. For example, say I have mBuilding that contains mFloor, that in turn contains mAppartment.

I have an xml file that contains data so the swf knows what to do with the MovieClips.


Code:
//xml
<my_data>
<movie_clip1>mBuilding</movie_clip1>
<movie_clip2>mBuilding.mFloor</movie_clip2>
</my_data>

//flash
//xmlMovies is the variable contaning xml data
trace (this[xmlMovies.movie_clip1]); //correct
trace (this[xmlMovies.movie_clip2]); //"... null object or reference..."
I've been trying different things, but I'm still stumped. Can anyone give me some advice?

Thanks in advance.

Problem Referencing The Stage
I'm having a problem that's got me completely baffled. I've got a swf file in which references to the stage give mixed results. When I test the file stand-alone, there are no errors. But when I load it from another swf, I get null object reference runtime errors. I'm referencing the stage at various points in the code, but the null errors occur only at one of those points. When I do

trace(stage)

from the code that lies outside of any function (I'm using free-form code, not a class) I get "null". But when I do the same thing from within a function, I get "[object Stage]". However, if I create a new function and reference stage from within it, I get "null". It seems to me that no matter where you reference the stage within a swf, it should always produce the same results. Am I mistaken?

Referencing Stage From A Child
Hi, I'm making a test game to flesh out my AS3 knowledge. Currently, I have a main class (let's call it gameTitle) that the game runs from. I have several other classes, including GameScreen which is eventually displayed using the addChild method. The third piece of the puzzle are the game controls. This block of code contains a method that requires 'stage' as an argument (it detects keys being held down).

This particular method works fine when it's a part of the main class. I want to move it to the GameScreen class, but I'm having trouble referencing the same 'stage' property from here without getting errors. I've tried parent.stage, but I get the following error message:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at GameScreen$iinit()
at gameTitle/menuSelection()

I should note that gameScreen is the class where the method is located. And this class is initiated by the menuSelection() method which is located in the gameTitle class.

Referencing A MovieClip On Stage Through XML
Hello.

I have a swf with several MovieClip instances on the stage at authoring time. For example, say I have mBuilding that contains mFloor, that in turn contains mAppartment.

I have an xml file that contains data so the swf knows what to do with the MovieClips.

I've been trying different things, but I'm still stumped. Can anyone give me some advice?

Thanks in advance.







Attach Code

//xml
<my_data>
<movie_clip1>mBuilding</movie_clip1>
<movie_clip2>mBuilding.mFloor</movie_clip2>
</my_data>

//flash
//xmlMovies is the variable contaning xml data
trace (this[xmlMovies.movie_clip1]); //correct
trace (this[xmlMovies.movie_clip2]); //"... null object or reference..."

Referencing The Stage From A Loaded Swf
I am converting my website, which has a liquid interface, to as3 but I am still learning and I have a problem.

I have child.swf that I load dynamically into parent.swf. When I run that I get:


Quote:




TypeError: Error #1009: Cannot access a property or method of a null object reference.




Through trial and error I found that the null object is the child.swf trying to reference the stage at several places such as stage.stageWidth. If I comment all of them out it runs error free, but it also doesn't do anything. I have tried replacing the first 'stage' with other things such as 'root.stageWidth' but no dice.

I was also wonder how I can have a button in child.swf unload itself from the parent.swf?

Referencing Objects On Stage
Ok, this is a dumb question but I'm just horribly stuck.
In my script I go toframe 5, and there are several textfields and clips on stage, but I can't reference them from my code. I get an error saying the objects don't exist.
If I move the objects of stage and just move them into place later that works but I'm pretty sure there is a better way to do it.

Any thoughts or links? I've checked around google but I don't know exactly what I should be searching for here.

Referencing To Stage, From MovieClip
Hi i've got little trouble... First files: http://rapidshare.com/files/12813666...there.rar.html

And now. How i can get from starterClass.as file to stage, and move to frame 2?

Referencing A MovieClip On Stage Through XML
Hello.

I have a swf with several MovieClip instances on the stage at authoring time. For example, say I have mBuilding that contains mFloor, that in turn contains mAppartment.

I have an xml file that contains data so the swf knows what to do with the MovieClips.

CODE//xml
<my_data>
  <movie_clip1>mBuilding</movie_clip1>
  <movie_clip2>mBuilding.mFloor</movie_clip2>
</my_data>

//flash
//xmlMovies is the variable contaning xml data
trace (this[xmlMovies.movie_clip1]); //correct
trace (this[xmlMovies.movie_clip2]); //"... null object or reference..."

Referencing Movie On The Stage Error
I have a movie_clip_A and a movie_clip_A on the stage.
From a frame in movie_clip_A and using a mouse over event, i'm trying to control movie_clip_B.

I have referenced the movie clip both relative and absolutely:
this.parent.movie_clip_B.gotoandPlay(frame);
root.movie_clip_B.gotoandPlay(frame);

But I keep getting this error. When I click go to source. It jumps to an unrelated line of code all together.

The error is:

1119: Access of possibly undefined property movie_clip_B through a reference with static type flash.displayisplayObject.

What I am not doing correctly? (By the way, i have double checked my instance names and spelling)

Referencing Stage Items From Packages
Take this very basic piece of code:


ActionScript Code:
package {
    import fl.controls.Button;
    import flash.display.*;
    import flash.events.MouseEvent;
   
    public class ControlButton extends MovieClip {
       
        public function ControlButton() {
            setupButtons();
            trace("buttons setup");
        }
       
        private function setupButtons():void {
            myPauseButt.addEventListener(MouseEvent.CLICK, pauseButtHandler);
        }
       
        private function pauseButtHandler():void {
            trace("-- pauseButtHandler: pause/play clicked");
           
        }
    }
}

it just traps a button click for a button component on stage.
If you instance it in the document class, directly in the fla, it works.

Instead if you instance it in another class, defined in another package, it doesn't find the button:

1120: Access of undefined property myPauseButt.

for the record, this is how I instance ControlButton:


ActionScript Code:
var cb:ControlButton = new ControlButton();
addChild(cb);      // tried with and without this, same thing.

MORALE: What should I do to see a button component on stage from some remote class?

Having A Problem Referencing Objects On Stage ?
Hi everybody,

I am having a problem referencing two objects on stage and telling them to swap depths. I have an object called "illustration" on the stage that has two separate layers inside of it. These two layers hold "illustrationText" and "illustrationTextRed". My problem comes when I try to swap the depth of the two child objects (illustrationText, illustrationTextRed).

The code I placed on the timeline:


PHP Code:



illustration.addEventListener(MouseEvent.ROLL_OVER, onIllustrationOver);
illustration.addEventListener(MouseEvent.ROLL_OUT, onIllustrationOut);

function onIllustrationOver(event:MouseEvent):void
{
    root.illustration.swapChildren(illustrationText, illustrationTextRed);
}

function onIllustrationOut(event:MouseEvent):void
{
    root.illustration.swapChildren(illustrationText, illustrationTextRed);





Compiler errors keep getting thrown:
Access of undefined property illustrationText
Access of undefined property illustrationTextRed

Am I going about this the right way?

Thanks for your help!

-Brian

Referencing Stage.stageWidth From A Class
I created a custom class in a .as file. I then linked this custom class with a symbol from the library in my .fla file. However, I can't reference stage.stageWidth in my custom class file. I get a null object error.

I think this happens because the custom class file is associated with a symbol on the stage and not the stage itself. For example, if I set the fla file's Document Class to the name of my custom class I can reference stage.stageWidth in the custom class. But I don't do this because I am creating multiple instances of the symbol on the stage. In order to do that properly i found I have to set the class in the properties panel of the symbol to the underlying class which then defines how each symbol behaves.

Under this type of linkage, is there a way to reference the stage width from the class?

I've tried root.stage.stageWidth and parent.stage.stageWidth to no avail. I also made sure to import flash.display.* in my custom class.

Below is the code for my .fla file and my .as file. In the .as file you'll see the line "x = Math.random() * stage.stageWidth;". This is the line giving me problems. I could hard code it, as I do for the y variable on the next line, but I'd prefer not to in order to keep the code flexible.

I also attached the files in a zip.

Any help would be appreciated.


ActionScript Code:
//.fla code

var i:int;

for(i=0; i < 100; i++){
    var myBall:flaBall = new flaBall();
    addChild(myBall);
}


//.as code

package {
   
    import flash.display.*;
    import flash.events.Event;
   
   
    public class Ball extends MovieClip{
       
        var dx:Number;
        var dy:Number;
       
        public function Ball(){
            addEventListener(Event.ENTER_FRAME, onEnterFrame2);
            reset();
        }
       
        private function reset(){
            x = Math.random() * stage.stageWidth;
            y = Math.random() * 400;
            dx = Math.random() * 20 - 10;
            dy = Math.random() * 20 - 10;
        }
       
        private function onEnterFrame2(event:Event):void{
            move();
            checkBounds();
        }
       
        private function move(){
            x += dx;
            y += dy;
        }
       
        private function checkBounds(){
            if (x > 550 || x < 0){
                dx *= -1;
            }
            if (y > 400 || y < 0){
                dy *= -1;
            }
        }
    }
}

Referencing Added Stage Children
I am trying to reference a child I added named "userInfo_mc" with nested inputText named "inputEmail". But I am getting this error when compiling referencing the line inside the userInfoSubmit function :

1120: Access of undefined property userInfo_mc.

Any Ideas? Any help is appreciated











Attach Code

function individualAccount():void
{
var userInfo_mc:UserInfoMC = new UserInfoMC();
addChild(userInfo_mc);

userInfo_mc.emailInput.addEventListener(MouseEvent.MOUSE_OVER, showEmailInfoBubble);
userInfo_mc.emailInput.addEventListener(MouseEvent.MOUSE_OUT, hideInfoBubble);
userInfo_mc.continue_btn.addEventListener(MouseEvent.CLICK, userInfoSubmit);
}


function userInfoSubmit(event:MouseEvent):void
{
if (userInfo_mc.emailInput.text == ""){
trace("Fill this out!");
}
}

Referencing Stage From External Class
I have an external class file that extends the MovieClip class and is linked to a movieClip on the main stage. I need it to be able to access properties of other movieclips on the main stage. How could I do this. Here is what my base movieclip class that I want to access the stage with looks like. Remember, it is linked to a movieclip on the stage, if that matters...
Obviously there is more code in the class, but I removed it for the sake of simplicity.







Attach Code

package{
import flash.display.MovieClip;
import flash.display.DisplayObject;
import Math;

public class Test extends MovieClip{

public function Test(){ //Constructor

}
}
}

Referencing Stage.stageWidth From A Class
I created a custom class in a .as file. I then linked this custom class with an symbol from the library in my .fla file. However, I can't reference stage.stageWidth in my custom class file. I get a null object error.

I think this happens because the custom class file is associated with a symbol on the stage and not the stage itself. For example, if I set the fla file's Document Class to the name of my custom class I can reference stage.stageWidth in the custom class. But I don't do this because I am creating multiple instances of the symbol on the stage. In order to do that properly i found I have to set the class in the properties panel of the symbol to the underlying class which then defines how each symbol behaves.

Under this type of linkage, is there a way to reference the stage width from the class?

I've tried root.stage.stageWidth and parent.stage.stageWidth to no avail. I also made sure to import flash.display.* in my custom class.

Any help would be appreciated.

Changing Dimensions Of The Whole Movie (stage Size And All Elements)... [MX2004]
Hi there...

Is there a way to easily change the stage size of a movie and all the elements within?

It can be done manually bit by bit (selecting and shrinking elements only applies for the currently viewed block of frames), but I've got 750 frames and many layers... and that makes it a nasty business... so needless to say I'm hesitant to go through that if there is in fact a fast, convenient method out there!

Thanks for any help!

Problem With Elements Moving Off Stage When Focus Is Off The Browser Window...
i have elements in my movie that slide back and forth on the stage depending on where my mouse is on the stage. It works fine.

When if I move off the browser and do other things, or if I go to another tab in Firefox, when I come back, all those elements have slid off the stage out of view. When I put my mouse back on the stage, they will all slide back to the correct spots, but it looks goofy and incorrect when that happens. Any reason why this is happening?

Referencing Author Time Buttons On The Stage?
I have some buttons on the stage that were manually placed during authoring. They all have their own instance names manually assigned already. I need to code them thru my Document Class. How do I get reference to them?

I know how to do this if I am placing them from the library at runtime, but not this way.

Thanks

Initializing Library Assets, Setting Up Stage Elements And Running Sequences...
Hello

I'm relatively new to AS3, but have decent experience with OOP PHP...I'm looking to get some advice or be pointed to some reading on an OOP approach to structuring Flash applications. More specifically...though I've read quite a lot lately on AS3 and OPP, I can't find many practical examples for the following:

1. Using an object to manage initializing library assets and setting up stage elements:

I know how the display-list works, and how to dynamically add library symbols to the stage, etc...But how about managing the initialization of all needed visual library assets when an application starts?

Having built AS2 projects, I was calling a function to load movieclips of various sorts from the library to the stage and set their initial state (x,y,alpha). Once on the stage, I'd reference another function to run certain animations coded for that movieclip, etc.

Any advice on abstracting this process would be great...even if it's your favorite chapter from your desert island AS3 book...or even a discussion on the structure of a document class for this type of purpose...

2. Using an OOP approach to building and running animation sequences:

Having done some coding in AS2, I was using various Tween class packages (Tweener or Fuse, etc) to build animation sequences. Using the same packages, can anyone advise me or point me to a discussion sequencing animation events using an OOP approach?

Looking around, I came across this class:

http://www.senocular.com/flash/actio...ts/Sequence.as

(This guy is great!). Perhaps this is the direction I'm looking for...can anyone explain or point me to a discussion on a practical implementation of this class?


I hope I'm making sense with the above questions...

Thanks in advance!
sd

Moving Running Forward But Elements Moving Off Stage
I'm positive I've done it by the book. All symbols on the stage - one by one dragged them off the stage creating timelines - about 6 layers. Play the movie and all the elements start on the stage and move off. Just the way I wanted it but in reverse. Simple vertical and horizontal motions. My mistake must have been in the beginning somewhere - but where ?

Elements Within Elements Creating Line Break - CSS Formatted Text
Im trying to format some text using elements within elements so i can have certain sections a different style or whatever (like underline a bit) - but when a new element is inserted to do this, it creates an unwanted line break

This is the actionscript to create the text on some timeline.

ActionScript Code:
_root.cssStyle(details_txt)

details_txt = "<.main><.date>Some date:</.date>Some text<br>"
details_txt += "<.date>Some date:</.date>Some more text"


This is the actionscript on the _root level. *NB* <a href='bla bla'> hyperlinks or <b> or <u> etc, dont create linebreaks.. only custom tags

ActionScript Code:
cssStyle = function(my_txt){
   
var my_css = new TextField.StyleSheet();

my_css.setStyle(
"a",{
    textDecoration: 'none',
    color: '#09A8D7'
    }
);
my_css.setStyle(
"a:hover",{
     fontFamily: 'Arial',
     fontSize: '10px',
     textDecoration: 'none',
     color: '#0C758B'
    }
);
my_css.setStyle(
".main", {
     fontFamily: 'Arial',
     fontSize: '10px',
     color: '#000000'
}
);
my_css.setStyle(
".date", {
     fontFamily: 'Arial',
     fontSize: '10px',
     color: '#666666'
}
);

 my_txt.styleSheet = my_css;
 my_txt.html = true;
 my_txt.autoSize = "left";
 my_txt.scroll = false;
 my_txt.multiline = true;
 my_txt.wordWrap = true;
}

Sort Random Elements Into Ascending Elements
Dear Sir or Madam:

How do I get column A to display as Column B. Column B is just an ascending array of the same numbers in Column A.

Can't this be accomplished with a query update built-in function?

Column A ColumnB
08,24,11,21,22 08,11,21,22,24
19,18,09,22,14 09,14,18,19,22
23,22,06,21,08 06,08,21,22,23
10,06,23,12,02 02,06,10,12,23
17,10,06,20,02 02,06,10,17,20
22,18,07,01,06 01,06,07,18,22
17,16,09,11,02 02,09,11,16,17
08,12,10,19,23 08,10,12,19,23

Movieclip Referencing Another MovieClip On Stage
Hi all,
I have a movieclip with dynamically loaded content in a movieclip that sits on the stage, which works fine, it loads the content fine. Call it Clip A
I want multiple movieclips to reference this movieclips content. ie I want a copy of this Clip A to appear in multiple movieclips.

Real example
Clip A loads teamshirt Arsenal
Multiple clips to also have Arsenal teamshirt by looking at ClipA

Any ideas? Do i go about it using loadMovie and pointing it to the scene or attachMovie?

thank you in advance
Jason

Unhappy Adjusting Columns And Rows On Stage Resize, According To Stage.width.
Hey fello flashers,

what i'm trying to achieve can be seen here, at the FWA's website.

When you resize the browser window the thumbnails rows and columns adjust accordingly to fit.I've managed to attach the thumbnails correct when my enableButtons() function is called but i'm unsure how to approach resizing.

if anyone has encounted this problem before or can help, then pls do i'm a little confounded on this one.

thanks
cam

Stage.align = "TL";

var numberOfGalleries:Number = 20;
var thumbMarginX:Number = 163;
var thumbMarginY:Number = 109;

function init():Void {
enableButtons(numberOfGalleries);
resizeStage();
}

function enableButtons(numberOfGalleries:Number):Void {
currentRow = 0;
currentColumn = 0;
for (i=0; i<numberOfGalleries; i++) {
tracker = i;
thumbsDisplayer = this.createEmptyMovieClip("thumbsDisplayer_mc", this.getNextHighestDepth());
currentThumbnail = thumbsDisplayer.attachMovie("thumbnail holder", "thumbnail"+(tracker+1), thumbsDisplayer.getNextHighestDepth());

currentThumbnail._x = currentColumn*thumbMarginX;
currentThumbnail._y = currentRow*thumbMarginY;
currentColumn++;
if (currentThumbnail._x>(Stage.width-(currentThumbnail._width + thumbMarginX))) {
currentRow++;
currentColumn = 0;
}
}
}

function resizeStage() {
var myListener:Object = new Object();
myListener.onResize = function(e:Object):Void {
//
}
Stage.addListener(myListener);
}


init();

Stage.width && Stage.height Doesn't Work Anymore?
How do you get Stage.width and Stage.height in ActionScript 3.0

2.0 this works like a charm. I guess they may have moved this inside a deeper class or something.

thanks in advance.

Create Array On Stage, Mathematically Referring To Objects On The Stage
Ok what I want to do is create a set of small images on the stage and name them sequentially like you would an array, then refer to them mathematically in actionscript. I tried naming them as an array but it says that the name is reserved for the system or something. Does anyone know how to get an array of objects onto the stage, or have an idea of something else I could do to get the same effect?

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