ActionScript 3.0 :: Access MovieClip On Stage From Class?

Jan 6, 2010

I've created a custom class (not the document class, otherwise there would be no problem) and I want to be able to access a MovieClip that is sitting on the stage.

How? MovieClip(parent), MovieClip(root)... don't work. What's the proper procedure?

Also, can I pass the MovieClip from the Document Class to another custom Class?

View 6 Replies


Similar Posts:


Actionscript 3 :: Access A MovieClip On The Stage Using Class?

Sep 2, 2011

public class MyClass extends MovieClip {
public function MyClass():void {
my_mc.addEventListener(MouseEvent.CLICK, action);
}
private function action(e:MouseEvent):void {

[Code]...

I can't able to access the my_mc(placed in FLA) movieclip. How do I access?

View 2 Replies

Flash :: Access A MovieClip On The Stage From The Document Class?

Jan 7, 2010

I have a "box_mc" movieclip on the root of my stage and I need to select it from within my Document Class. I thought Stage.getChildByName("box_mc") would work, but it just returns null.

View 2 Replies

Flash :: Access MovieClip Instances That Are Already On The Stage In Document Class?

Dec 15, 2011

I have created a game in flash, and due to the nature of the game, I have many movieclips placed on the stage manually in Flash CS4. They are not programmatically added as children to the stage, and so I am having difficulty getting access to them in the document class. So far the only method I have been able to use is to do stage.addChild(active_area); (for example), but there are many movie clips, all very differently named, so this method seems incorrect.I've discovered that my MovieClips are not children of the stage, but in fact MainTimeline, as when I for loop through stage.getChildAt(i);, only one child, root1, is traced out. How can I access movieclips that were placed on the stage in the timeline from the document class, without having to manually add them as children to the stage? So it looks like my problem wasn't that I couldn't access the MovieClips, it was that I wasn't modifying the MovieClips' values, so I wasn't registering any change in them.

Here is the code after I fixed it:
function manage_cursor(e:Event):void {
prevX=currX;

[code].....

View 2 Replies

ActionScript 3.0 :: Call Function, Pass Value, Access Variable In Movieclip Class From Main Stage?

Nov 20, 2008

I have a movieClip named MC, and it's enabled with action script, with the class name MC_Rectangle and a Stage.I override the MC_Rectangle class file in a mc_rectangle.as external file.here is the code:

package{
import flash.display.*;
import flash.events.*;[ code].....

I have new a object in the main stage var

mc_rect:MC_Rectangle = new MC_Rectangle()

in main stage:

1. how can i access the variable "sequence" in "mc_rect"

2. how can i pass parametre from main stage to mc_rect via function setSequence(data:int)?

3. how can i call the function in addSequence() in mc_rect.

in asp.net, i usually use mc_rect.sequenct,mc_rect.setSequence(data), mc_rect.addSequence() to achieve my goals......btw, can function in mc_rect return out result to main stage?

View 1 Replies

Actionscript 3 :: Access A Displayobject On Stage In A Class That Is Not A Document Class?

Mar 7, 2012

How to access a display object on the stage in a class which is not a document class?

I am looking for a solution that doesn't involve passing the stage as a parameter to the class.

One solution i always come across is using "TopLevel.as". Is it a good method because as far as I have heard using global variables is not recommended because it might cause some problems while working on big projects.

View 1 Replies

ActionScript 3.0 :: Access The Stage Property From A Different Class That's Not The Principal Class?

Jul 2, 2009

I was wondering how do you access the stage property from a different class that's not the principal class tied to the fla? Essentially, I have main.as which calls another class menu.as, and I can't seem to be able to use the stage.stageWidth property from menu.as. What's the proper way to be able to use the stage property from any class? Do I have to import it separately each time?

View 2 Replies

ActionScript 3.0 :: Can't Access Variable On Stage From Within Movieclip Thats Placed On Stage

Aug 18, 2009

I can't access a variable on a the stage from within a movieclip thats placed on the stage.

View 4 Replies

Flash :: Access Dynamically Loaded Movieclip (stage > Scrollpane > Myloader > Movieclip)?

Oct 16, 2011

what I'm trying to do is accessingsnapText = scrollPane.source.textSnapshot;from an external swf. I've tried:

trace("-->: "+scrollPane.source.textSnapshot.getText(0, 1000));
trace("-->: "+myLoader.content.textSnapshot.getText(0, 1000));
trace("-->: "+mc.textSnapshot.getText(0, 1000));

[code].....

View 3 Replies

ActionScript 3.0 :: Access A Movieclip On Document Class From Another Class?

Mar 3, 2011

Going further on my app, I felt in another problem. Despite having lots of posts on the web regarding this, none of the solutions worked for me In my document class (Main.as) ve two containers. One empty and another with a star that is being imported from the library. Here´s the main class:

package
{
import flash.display.*;

[code]......

View 4 Replies

ActionScript 3.0 :: Access Class From Stage MC?

Apr 16, 2009

I have a MC, instance name "jez_mc" this is inside an MC, instance name "container_mc". container_mc on on the stage.I then have an MC dynamically added to the stage. In this MCs timeline I want to access a variable stored in the class that is linked to jez_mc. This var that I want is named "score"So i figured in my timeline I could use something like:

var _jez_mc:MovieClip;
_jez_mc = MovieClip(root).container_mc.jez_mc;
trace("_jez_mc.score");

[code]....

View 4 Replies

ActionScript 3.0 :: Access Stage In A Class?

Feb 10, 2010

how can i access Stage. inside a class?

View 9 Replies

Actionscript 3.0 :: Access The Stage From A Class?

Feb 27, 2009

How can i access the stage from a class? Let's say i have

Code: Select all
public class Photo extends MovieClip {
....
//contains a photo

[Code].....

View 3 Replies

ActionScript 3.0 :: Access A Var From Stage Using A Class?

Feb 18, 2010

I have var on my stage and i want my class to be able to accessthat var.Here's what is on my main.fla:

Code:
import ShapeOuts;
var ShapeDetect = 0;

[code].....

View 3 Replies

ActionScript 3.0 :: Reference Movieclip On Stage From Custom Class Of Document Class

Dec 7, 2009

Is there a way I can reference a Movie clip I have on the main stage from a custom class of a document class?[code]

View 1 Replies

ActionScript 3.0 :: Access A Movieclip Via Its Instance Name In Another Movieclip Class?

May 28, 2011

how can i access a movieclip via its instance name in another Movieclip class?

and a nother question how can i access a movieclip via its class name in another movieclip class?

BTW i want to access the movieclip child

View 4 Replies

ActionScript 3.0 :: Access Stage Objects From Class

Feb 24, 2010

I'm trying to access a MovieClip created within the authoring tool from an ActionScript class. Here is my code:

PHP Code:

package {
import flash.display.*;
public class MoreVideos extends Sprite {

[Code].....

I also tried changing that to [stage.moreVideosBox.visible = false;], but I then got "1119: Access of possibly undefined property moreVideosBox through a reference with static type flash.display:Stage."

Is it possible to directly alter items in the authoring tool from a class? If I move 'moreVideosBox.visible = false;' outside of the class, in the main .as file, it works fine.

View 3 Replies

ActionScript 3.0 :: Access Objects On Stage From Within Class?

Mar 3, 2011

i have textfield myTxt on stage, and i have Room.as class file.

Actionscript Code:
package  { public class Room {  public function Room() { // constructor code myTxt.text = "yo!"; }

I need to access objects on stage from within class.

View 3 Replies

ActionScript 3.0 :: Access Textfield On Stage From Another Class?

Jan 13, 2009

This is for AIR: My document class imports a separate class "ConnMonitor" and uses it to constantly monitor the network connection. It's at the very end of that class where it's supposed to update a textfield on the stage as the connection changes, but the class can't access the textfield.

View 8 Replies

Actionscript 3 :: Access Stage In A Class That Is Not DisplayObject?

Jan 28, 2010

How do I access the stage in Actionscript 3 in a class which is not my main class and not a displayobject?

View 4 Replies

ActionScript 3.0 :: Class/Object & Stage Access?

Jan 6, 2010

I have a document class called Main, and a class called DispatchEventExample. In DispatchEventExample, I'm trying to add an event listener to the stage but get an 1120 error, access of undefined property stage.

If I understand things correctly, even though I create an instance of DispatchEventExample in Main, it's not added to the display list & therefore cannot access stage.

[Code]...

View 1 Replies

ActionScript 3.0 :: Class Access Child On Stage?

Jan 28, 2009

I need a class code to access a child instance of another class code that is on the stage. I have a class code named Ball.as. On the Time Line is a child of the Thing class. It is call newThing. Here is the code in the Ball.as file:

Code:
package {
import flash.display.MovieClip;
import flash.events.*;

[Code]....

I get an error message saying that newThing is an undefined property.

View 2 Replies

ActionScript 3.0 :: Can't Have Access To Stage In Document Class

Aug 30, 2010

Just tried using cs5 on my new macbook and I have a tlf text object on the stage with an instance name of mText. I tried to access (mText.text = "test") it like this and got a null object reference. I tried to trace the stage from my document class and it was null when the tlftextbox was on the stage but i could trace stage correctly when I deleted the textbox. [code]...

View 2 Replies

ActionScript 3.0 :: Access To Stage From Class Object

Nov 16, 2010

I have a class that have a method to do some work and return a MovieClip. How can I access the stage from the class ? I don't add the class object to stage.

My code is like this :

Code:
import com.ClassName
.
.
.
var c:ClassName= new ClassName();
var mc:MovieClip;
mc = ClassName.create("some parameter");

I want to get access to the stage from ClassName class file.

View 3 Replies

ActionScript 3.0 :: Reference Movieclip On The Stage From A Class Of The Document Class?

Dec 8, 2009

Is there a way to refer to a Movieclip on the stage from a class file of the document class

Lets say I have 3 MovieClips on the stage(a Circle, a Square and a Triangle)

I have the document class which calls another class that controls the MC on the stage

Example

ActionScript Code:
package {
public class Example extends Sprite {
//Create the instance of the class being called

[Code]....

View 1 Replies

ActionScript 3.0 :: Stage Text Field Access From Class?

Feb 22, 2009

I have a dynamic text field on my stage, instance name: "lives_txt"

I want to populate this field from my Document class "Ball.as"

So in my Ball.as class I have tried: parent.lives_txt.text = String (lives);

where: public var lives:int = 3;

I get an error: access of possibily undefined property lives_mc through a reference with static type flash.display:DisplayObjectContainer.

View 2 Replies

ActionScript 3.0 :: Access Stage Instances Outside Of Document Class?

Nov 20, 2010

I can access the targetObj instance inside the document class, but when I try to access it in another .as class,get this error:
 
Access of undefined property targetObj. 

View 9 Replies

ActionScript 3.0 :: Access Stage Property Through Document Class?

Jan 28, 2011

I m trying to access stage.width property but sometimes it trace 650 and 720 but i see my flash file dimension is 500x400, I need to align objects on stage..

View 1 Replies

ActionScript 3 :: How To Access Stage Properties In Custom Class

Jul 26, 2009

How do I access Stage Class properties in Custom Class?
Class:
package {
import Main;
import flash.events.*;
import flash.display.Sprite;
import flash.display.Stage;
public class Run extends Sprite {
[Code] ....

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

View 3 Replies

Actionscript 3 :: Access The Stage From A Class In Adobe Flash

Apr 21, 2010

The problem I've encountered is that I am using a keyboardEventListener to make a movieclip run around. As I'm a college student, I'm creating this for an assignment but we are forced to use as3 classes.

When I run the code in the maintimeline, there is no problem. But when I try to access it from another class (with an 'Export for ActionScript' on the movieclip in question) I get an error he can't address the stage.

this.stage.addEventListener(KeyboardEvent.KEY_DOWN, dostuff);

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved