ActionScript 3.0 :: Accessing Stage Objects From Other Objects?

Jul 24, 2010

I have drawn colored rods which I have placed in the library and have put one of each on the stage with instance names likeblueRod_mc, etc.I place them around with time-line code like
blueRod_mc.x = 300.0;I have now created an Actionscript class called Problem.I build a new object from Problem which I have called Riddle.But when I put blueRod_mc.x = 300.0 in a method (of Problem),I get the message that blueRod is not accessible.So I triedstage.blueRod_mc.x = 300.0;That did not work either.

View 9 Replies


Similar Posts:


ActionScript 3.0 :: Accessing Objects Already On The Stage?

Nov 10, 2009

I'd like to be able to access some objects which are on the stage before compile time (e.g. in my .fla file). I can do this fine from the document class using the names I've assigned to them, but I need to be able to do this from other classes (instantiated at runtime) too.
 
What is the best way to go about this? Can I use the stage variable (this isn't looking likely from what I've read so far) somehow? Or do I need to pass in references to these objects from my document class when I create the instances of the class that needs to access them?

View 8 Replies

ActionScript 2.0 :: Accessing Stage Objects Through String Name?

Aug 26, 2009

have a button on the stage that you called "myButt". Now suppose you want to change its size. You write:myButt._xscale = 25;Now suppose you don't know it's name, but you get the name from another variable:buttname = "myButt";How do you change its size then? in some compiler languages you can expand the string buttname into its value at compile time, with special flagging, such as:

View 4 Replies

ActionScript 3.0 :: Accessing Stage Objects With In A Class

Aug 20, 2009

I am trying to learn how classes can interact with each other and I came across a problem I can't solve. On my stage I have a MovieClip called "myMovieClip".

[Code]...

View 14 Replies

ActionScript 3.0 :: Navigating Or Accessing Objects Added To Stage?

May 22, 2009

I have a structure display like this: (brackets shows the depths, within their parent)

my question concerns 'communication' between the highlighted objects - so you don't have to waste time understanding the whole tree! I've just added this to provide some context!

mc_init (0)
___|
___mc_page (0)

[Code]....

Now, its easy to add a mouse event to btn(1), but how do I get this button to set the visible property (say) of 'rectangleBG(0)'

how do I access the paths? of these objects added to the stage?

View 2 Replies

ActionScript 3.0 :: Flash - Accessing Stage Objects From Class File?

Mar 11, 2011

i have an issue in accessing stage objects from class files.Here is my code

package
{
import flash.display.MovieClip;

[code].....

View 1 Replies

ActionScript 3.0 :: Accessing Objects In Other Functions

Jan 15, 2009

I'm working on a flash video player and I'm trying to figure out how to access something inside the constructor that I know is set but it keeps telling me its not.

[Code]....

now in the metadata function its giving me the error, "Access of undefined property video" Now, am I just completely not understanding how classes work or is this a common problem?

View 4 Replies

ActionScript 3.0 :: Accessing Objects From Other Classes?

Jan 7, 2012

I want to access an object from a class in which it was not created in. I have a main class (A) in which I create and instantiate an object (of class B), from this class I can obviously do whatever I want with the object, no problem. The issue I'm having is another class (C) needs to access the object in question to change its x and y location values. Class C doesn't know what the instance of class B, created in class A, is; this doesn't surprise me, but I can't figure out how to allow class C to get access to what class A created.

View 7 Replies

ActionScript 2.0 :: Accessing Array Within XML Objects?

Sep 19, 2006

Here's my code:

Code:

function loadProjects(loaded){
if(loaded){
projects = this.firstChild.childNodes;

[Code]....

the traces within the function return correct results, however when trace values of the arrays within the function and created by the xml are attempted results are returned 'undefined'.

Why can I not access arrays made in this way from outside of the function?

View 2 Replies

ActionScript 3.0 :: Accessing Dynamically Created Objects?

Mar 17, 2009

If objects are created dynamically in AS3, using code like this:

for (var num:Number = 0; num<10; num++){
var txtFld:TextField = new TextField();
txtFld.text = 'This is the original text';
this.addChild(txtFld);
}

then later, i want to changet the text of one of the TextFields, how can I do that? The only instance listed in the variables is a single instance of "txtFld" and it is the last one that is created. How can I access the others?

View 1 Replies

ActionScript 3.0 :: Accessing Objects In Display List?

Dec 13, 2009

I have a stage with instances of bauble_mcs on it that are attached by the document class of the main timeline (can someone tell me what the right term is here?  I don't know what I call the main time line in AS3).
 
I then have instances of snow_mc attached by the same class.  Inside the snow_mc I want to test to see if it is hitting any bauble_mcs but I don't know how!

[Code]...

View 8 Replies

Flex :: Flex3 - Accessing Flexs Objects By Id?

Jul 5, 2010

I have a datagrid which has id="myGrid" in my application, from it I call a component. Now from the component I can call parentDocument.myGrid.selectedIndex = 0; and it works fine.But I want to make the component reusable, and I would like to pass the ID to the component each time, so myGrid will change, how to properly send the ID to the component, and use it in the component?

View 2 Replies

ActionScript 3.0 :: Accessing Custom Objects Dynamically?

Sep 8, 2009

I have a mc in my library called recentArticlesButton, exported as a movie clipHere's my code:

Code:
public class ABCDEF extends MovieClip {
private var recentArticlesButton:RecentArticlesButton = new RecentArticlesButton;

[code]........

View 4 Replies

ActionScript 3.0 :: Accessing Objects With Linked Classes?

Sep 15, 2010

So I have a menu built inside of Flash CS4 that has a graphic for a background and five text fields that sit on it for menu options. The whole thing is saved as a movie clip in the library. The text fields all have instance names like infoBtn and mapBtn etc. and the menu is already on the stage and linked to it's own class in the library. My problem is accessing those text fields on the menu from the class. I keep getting "Error #1009: Cannot access a property or method of a null object reference." and the menu doesn't work. But if I trace the infoBtn.text in the class it outputs the text that is in the text field. So the code is accessing it but it's still not working?

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

[cODE].....

View 0 Replies

ActionScript 3.0 :: Accessing Random Objects In Array?

Mar 1, 2011

loop run a function to add Objects to fall upon stage, how do i have my function access random objects within an Array to replaced Platform1

function addPlatform1(){
var p:Platform1 = new Platform1();
stage.addChild(p);

[Code]....

View 2 Replies

Actionscript 3.0 :: Accessing AddChild Objects Indiviually

Dec 15, 2009

I'm a seasoned AS2 developer who's been dragged kicking and screaming into the world of ActionScript 3.0. I'm working on revising an old project coded in AS2 that needs to be re-coded in AS3 and It's been slow going. I have a question regarding addChild (attachMovie) function. My scenario is as follows: I'm pulling data from an XML file that dynamically builds a scroll list from items in the library. Each item in the list has an individual button function attached to it. I'm generating my list just fine, but I can't access the items as individual buttons. Instead, it seems that the entire list has the properties of the last child added.

[Code]...

View 3 Replies

ActionScript 2.0 :: Accessing A List Of Objects Within A Movieclip?

Jan 14, 2008

I have a movie clip on my scene with a number of objects all prefixed with a keyword 'build' (e.g. 'build8934', 'build4920') - is there any method, array or object that I can access that would give me access to a list of objects for that movie clip?I'm intending to loop through an add events to an instance which matches the prefix 'build' and set additional properties based off that instance.x.

View 2 Replies

ActionScript 3.0 :: Using Objects When Accessing A Public Function?

May 4, 2009

I have (may be a simple solution needed) a problem with a class I've wrote. I've wrote a class named Navigation [URL] and in there I make all the buttons for the navigation. Next to that I have a Ipage class [URL] and in there I have all the pages stored. When I click on a button, the Navigation Class is called and tries to access the public function ChangePage in the Ipage class. In the ChangePage function I trace if the function is called and the trace comes back. So it works... BUT if I want to access another object it's not working. I can't even set sprites on visible = false.

View 7 Replies

ActionScript 3.0 :: Accessing Library Objects From External Class?

Jan 18, 2011

I'm currently working on a game. I'm breaking down each piece of the game into individual classes and movieclips. The intro begins by going to the main menu which is a MC in my fla library. This is called through the document class. then all actions the main menu MC performs are commanded through the MainMenu class. When starting the actual game, MainMenu calls a function from the document class, after it is removed from the stage, that puts an empty movieclip called Level on the stage.

View 2 Replies

ActionScript 3.0 :: Accessing MovieClip Objects On Parent MovieClips?

Sep 11, 2009

So for my main timeline:

var lightBox:mc_lightbox = new mc_lightbox();
lightBox.x = 300;
lightBox.y = 200;
addChild(lightBox);

I get a lightbox up on the screen, within the lightbox is some more script, there are three menu options for that new window. So far when you click on it the loading part comes up just fine but whenever I have it go to another scene it leaves behind the lightbox above. I'm able to removeChild(loading) because its right there just a function above but I'm unable to removeChild(lightBox) because it's one up. How can I access that child? I tried many variations of parent, MovieClip, and root relationships but still couldn't get flash to find it.

View 1 Replies

ActionScript 3.0 :: Accessing Objects In Document Class From SubClasses

Apr 26, 2010

I'm trying to access a MovieClip object in a SuperClass from a SubClass. The only way I can tell this is possible is through an event dispatch, but I'm dealing with a preloader and a loaded external SWF. So I can't make an instance of the "not yet loaded" classes because I'll get errors. Furthermore, the objects in both SWF need to be controlled in sync.

View 9 Replies

ActionScript 3.0 :: Flex Accessing Objects Inside An Array?

Sep 23, 2009

i have a problem accessing the objects present inside an array.

For example,

var array:Array=new Array();
var obj:Object = {};
var int a=1; var int b=1;var int c=1; var int d=1;

[Code]....

Later I am able to get the array length but how can i get the values inside the objects??

One more thing is i am sending this array to php so how can i access the object values inside an array in php.

View 2 Replies

ActionScript 3.0 :: Flash Dynamically Declaring/accessing Objects?

Dec 8, 2010

So heres my code in my main game loop:

Code:
if (! initialized)
{
for (var c = 1; c < 1000; c++)

[Code].....

The error given is "1120: Access of undefined property particle4." However, everything traces correctly, but the individual particles cannot be accessed outside of the loop. Eventually I want to add the next particle at the mouse position on every click, but obviously I can't do that without being able to access the individual particles. I also read about having to use getChildByName() to access names set in AS3, but I haven't been able to get that to work either.

View 2 Replies

ActionScript 3.0 :: Flash Video Player - Accessing Objects In Other Functions

Jan 15, 2009

I'm working on a flash video player and I'm trying to figure out how to access something inside the constructor that I know is set but it keeps telling me its not.

Here is the code
Select allpackage player {
import flash.display.Sprite;
import flash.media.Video;
import flash.net.NetStream;
import flash.net.NetConnection;
import flash.utils.Timer;
[Code] .....

Now in the metadata function its giving me the error, "Access of undefined property video". Now, am I just completely not understanding how classes work or is this a common problem?

View 2 Replies

Actionscript 3 :: Centering Objects On Stage And Auto-Scaling With Stage Resize

Oct 19, 2011

I'm writing a web based flash app that's written entirely in AS3. I have objects on the screen as part of a GUI. I would like the user to be able to resize the window, or make it full screen. I would like everything to auto-scale with the resize, but also remain in the same relative position on the stage.

View 1 Replies

Flex :: Objects Drawn By Flash Graphics Class Exist As Objects?

Jan 16, 2011

Internally Flash obviously keeps a list of the primitives drawn using Graphics so I wondered if you have many such primitives in a Sprite, can you re-position/remove/alter individual items rather than clear and re-draw everything? Or is this deeper into the bowels of Flash than you're allowed (or recommended) to go?

View 4 Replies

Php - Flex Is Deserializing Generic Objects From Zend AMF Instead Of Strictly Typed Objects

Mar 4, 2012

I'm using Zend AMF to send my remote objects to Flex. I've defined a Constant class and created getASClassName() method. Then I've created Action script class in flex.

Objects are send successfully, but they are deserialized to generic Objects in Flex instead of specific ones. EDIT: On network monitor in Flex I can see that AMF value is set to com.my.project.valueobjects.Constant. Although array from event.result contains Objects.

[Code]...

View 1 Replies

ActionScript 3.0 :: Does Setting An Array Of Objects To Null Erase The Objects From Memory

Apr 27, 2010

I have an array of temporary objects created in a for loop. The objects are of type class "Tile", a class I created. However, it appears that whenever I create a lot of tiles in the for loop, the program slows down indefinitely.

While the array is whiped at a later trigger point, I am thinking that perhaps these Tile objects are not being erased from memory. They are being created on the fly in a for loop, and the array is being reset to "array = []".

Are the objects still in memory or are they cleaned up when the array is set to []?

View 3 Replies

ActionScript 3.0 :: Objects Class Find And Change Another Objects Xy Properties?

Oct 13, 2010

What I have is a game with a Level object, inside the Level is a Player object, and they don't have instance names given, what I'm trying to figure out is how to do is make it so that the player can change the x or y properties of the Level object.
 
To be more precise, I'm making it so that when the player moves in a certain direction, he either moves accross the stage, or he starts moving the Level object around the stage, it'd be in an Event kind of function, now I can easily make the Player move, but I don't know how to make the Level object move which the player is inside of.

View 3 Replies

Flex :: Converting Array Of ObjectProxy Objects To Custom Objects?

Jun 10, 2011

I have a service which returns an Array of ObjectProxy objects. I would like to cast this to a custom object (a value object) and create an ArrayCollection. How can I do this?ited:I am using Django and PyAMF for the backend. I had to write a custom SQL query and I am wrapping the resulting records in ObjectProxy and sending the whole result as an ArrayCollection.Here is my client side code:

[ArrayElementType("SessionVO")]
[Bindable]
private var _list:ArrayCollection;

[code]....

View 2 Replies







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