ActionScript 3.0 :: Assigning Class Name To String On Stage

Mar 11, 2009

I have a loop which add my button to the stage. However I want to assign a name to the buttons which is the same as the class. I am trying to use the AS keyword with no luck.

var movieList:Array = [AboutBut, WhatBut, OurWork, News, ContactUs];
var tempClip:MovieClip;
var tempClip:String;
var yPos:int = 0;
for (var i:uint=0;i<movieList.length;i++) {
[Code] .....

View 3 Replies


Similar Posts:


Actionscript :: Only Assigning A Piece Of String To Variable?

May 23, 2011

I have a XML document that I have to hard-code into AS (Yes, I HAVE to). I am trying to assign this xml to a string but for some reason on the xml doc declaration is assigned?[code]...

When I trace out the xmlDoc string I always only get "<?xml version="1.0" encoding="UTF-8"?>"

I have tried putting the whole document in one string surrounded by 's and concatinating the string like above. Why is the string var only getting assigned to the first line?[code]...

View 2 Replies

ActionScript 3.0 :: Assigning String To Movieclip Name Then Calling It?

Dec 1, 2010

So I'm having trouble calling my movieclips that I created and assigned strings to their names.So I'm trying to create 3 movieclips with 3 different instances and add them to the stage.here's the code:

for(var i:int = 3; i > 0; i--){
var myMC:MovieClip = new MovieClip();
var myMCName:String = "MCName"+String(i);

[code].....

View 3 Replies

ActionScript 3.0 :: Assigning Movieclips To Characters In A String/array?

Dec 22, 2010

I'm trying to make a Welcome ("User") animation for an eLearning template, and was asked to do it in AS3, which my team and I don't really have experience with (most of us stick w/ AS2 cos we're timeline oriented people), but the manager figured the best way would be to dive right in.The goal is to have handrawn letters w/ vignettes behind (like medieval books have) display a user's username (8-10 characters), which will be stored in one of two javascript variables, depending on which LMS the course is loaded into (one SCORM 2004, and one AICC).

I am able to get a loop to trace one letter at a time, which is a good start, I think, but getting the drawn object to go into an MC based on the characters is beyond me. I am also having trouble finding out how to check for the existence the vars on the HTML page.I have 10 empty MCs on the stage, with instance names of b0-b9, and the MCs with the images in them (yeah, they could just be graphic objects, but whatever) are titled iA-iZ and i0-i9.All I have thus far is

Code:
stop();
import flash.events.*

[code].....

View 9 Replies

IDE :: Assigning Different Class Paths?

Feb 9, 2009

i have a main page that loads a swf of an xml photogallery onto the main stage. I used the classpath in actionscript settings to target the actionscript files and xml data. So far, everything works well. Now, a button on the stage unloads this swf and then loads a second photogallery. The problem is that when it appears, it contains the same data (images) as the first photogallery. This is because it is using the same classpath as the first gallery. My question is how can i assign each gallery its own class path. It seems that only one can be selected at a time.

View 3 Replies

ActionScript 3.0 :: Assigning Different Class Paths?

Feb 9, 2009

i have a main page that loads a swf of an xml photogallery onto the main stage. I used the classpath in actionscript settings to target the actionscript files and xml data. So far, everything works well.Now, a button on the stage unloads this swf and then loads a second photogallery. The problem is that when it appears, it contains the same data (images) as the first photogallery. This is because it is using the same classpath as the first gallery. My question is how can i assign each gallery its own class path. It seems that only one can be selected at a time.

View 1 Replies

ActionScript 3.0 :: Assigning Variables To Specific Objects On Stage?

Jan 3, 2010

I may just be forgetting something really simple here but I'm stumped.I have 2 guys on the stage.I want one guy to do a certain amount of damage and the other to have a certain amount of health. The problem comes from having hundreds of guys coming and going and they all need to have stats attributed to them.I don't know where I could store those variables so they can be referred back to in the code. The guys on stage are all named guy1, guy2, etc. and it would be nice if there was a way to just say guy1.health and guy2.damage and store the variables in the objects themselves somehow.

Also, I already tried putting "var health = 10" in the actual objects in the library but for some reason it takes 2 or 3 frames in game for the code to call those variables from inside the object and it causes a lot of problems. Am I missing some much easier way to do this?

View 3 Replies

ActionScript 2.0 :: Assigning Array Elements To Objects On Stage?

May 6, 2005

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:

[AS]
//create a script assigning RGB color to a clip
function combineRGB (red, green, blue) {

[code]......

View 2 Replies

ActionScript 3.0 :: Assigning A Frame To Class Instance

May 4, 2009

I've created a card class that holds the specifics properties each card can have. Now I'm trying to figure out a way to associate the graphic with the card.  What I have now is a movieclip with each frame representing a different card. The movieclip is linked to the card class I created.I'm trying to do it with variations of  this.gotoAndStop(frame#) in the constructor of my card class, which gives me a card graphic but not having much luck in gettng the frame number to increment to the next frame with the next call for: var cardname:cardclass = new cardclass.The worse part of this is I'm not even sure I'm on the right track here, so my main question is: Is this even a viable way to accomplish this? If not, please give an overview outline of how I should be approaching this.

View 1 Replies

ActionScript 3.0 :: Assigning A Number To A Public Class?

Oct 12, 2011

Here is my code:

package
{
import flash.display.MovieClip;
public class Derp extends MovieClip

[code]...

What I would like to do somehow assign a number or word variable to display one of the public classes on the screen instead of all of them at once.

View 1 Replies

ActionScript 3.0 :: Assigning Either Symbol To A Variable Within A Class?

Mar 24, 2009

I am currently develoing a flash game and I am trying to spawn 2 different symbols from a class. I have a Class called 'PLayerClass', which contains a variable called 'hero' which I assign a symbol to. This works fine with 1 symbol but I have no idea or if it is possible to assign a different symbol to the variable 'hero'. The 2 symbols are 'soldierOrange' and 'soldierGrey'. For both of these symbols I have matching classes (ie. soldierOrange.as).soldierOrange.as

Code:
package {
import flash.display.*;

[code].....

View 9 Replies

Flash - Assigning Same Base Class To Many Library Definitions?

Aug 26, 2011

So I know you can assign a base class to a library definition within the Movieclips library information field but If I have 30 items in the library and I change the Base class this becomes a pain in the ass, can this be done programmatically when I instantiate the library definition?

var new_shiz:MyItem1 = new MyItem1(); // Needs to have a generic base class of MyItem

View 2 Replies

ActionScript 3.0 :: Assigning Custom Class To Loader Dynamically

Jun 5, 2009

I have a question regarding custom classes. I have created one named HrollBtns with a some scale and alpha roll over behaviors. When I load a jpg using a loader obj. Can I dynamically assign this custom class to the loader? If I had to do this loading an object from the library ...I would first assign the custom class through the linkage prop inspector and then simply add the Child(with my class behaviours) to the stage. Loading external files dont know how to do it...

View 2 Replies

ActionScript 3.0 :: XML Loader Class Instance And Assigning Values

Oct 6, 2011

I have a small issue with instantiation of an xml loader class. I'm using a standard way of loading external data and assigning it to "myXML" variable. My class uses event.COMPLETE for loader to make sure that data is fully loaded. Everything works fine until I make an instance of this variable in to my Main() class. The trace of "myXML" gives me null. It's like it didn't assign data on time. Since the onComplete event handler should take care of any delays it is hard for me to figure this out.

View 4 Replies

ActionScript 3.0 :: Class Can Add The Rectangle To The Root Stage Without Requireing The Instantiated Class To Be Added To The Stage?

May 3, 2010

I have a class called shapeC that only creates a rectangle and then addChild(rectangle);.  That class is instantiated on the main timeline.  Currently, the only way you can see that rectangle is to add the instantiated class to the stage via addChild(shapeC);.  My question is, is there a way that the shapeC class can add the rectangle to the root stage without requireing the instantiated class to be added to the stage?

View 4 Replies

ActionScript 1/2 :: Approximate The Functionality Of Assigning A Document Class To A FLA/published Swf?

Sep 9, 2011

Is there a way in AS2 to approximate the functionality of assigning a document class to a FLA/published swf?
 
I would like to publish a swf that is an instance of a Topic class (extends movieclip). For various reasons I can't use AS3, but I would really like to emulate that part. Any ideas?

View 1 Replies

ActionScript 3.0 :: Convert The String Var Which Is A String To The Class Name?

May 24, 2010

how do convert the myString var which is a string to the class name?

var myString:String = "movieClipInTheLibraryClassName"
var t:myString = myString()

View 1 Replies

ActionScript 2.0 :: Create A Class That Extends The String Class?

Jul 7, 2007

How do I create a class that extends the String class?

Lets say I've created an 'exString' class that extends String.

In my project file I do the following

Code:
var test:exString = new exString();
test = "Hello World";
text.someExStringFunction();

I get a type mismatch in my "Hello World" assignment because Flash sees it as a String and not as an exString.

View 3 Replies

Flash :: Get Stage.stageHeight Or Stage.stageWidth From Imported Class?

Jul 1, 2010

can you tell me a simple and clean way to pass the dimension of the stage to another class, imported in my documentclass?

View 2 Replies

IDE :: Acesssing Derived Class Children (stage Instances) From Base Class?

Jul 16, 2009

I'm slightly new to Flash CS3 + AS3 combo, so its more of a lack of practice question. My question stems from the problem described here http:[url].... . Note, its not the same problem, its a new one.The Problem ,So I have multiple library assets (which are on teh stage) and I want to assign similar functionality to all of them.

Attempt 1: So I create the n assets, create a custom class in AS3, link them to Flash CS3 and obviously enough it gives me the error that multiple assets can't be linked to the same class.Obvious enough to understand (well not completely, because from a programmers background it doesn't make sense).

Attempt 2: Same as attempt 1, but instead of linking all the assets to the same class I make the base class the same class, and let the derived class be dynamically created by Flash on compile time.So the linking works, but the problem is, in my base class I have a method which does something (say an tween) on a child of the library asset. So if the assets on the stage/library are called asset1, asset2, asset3 (same name for asset name, class name, id name), each of them has a sub-movieclip called ... say 'foo'. now if I manually wrote a class for each asset, I could do 'this.foo' to play with the sub-movieclip. However since this functionality is in the parent class, I'm unable to do it.

P.S. If you're form a programming/OOP background, its basically a abstract class problem. My Base class knows how to doSomething(), but it needs aSomething, which is defined in the Derived classes. However I found out that AS3 classes don't support virtual(C++ )/abstract (Java) in the true sense of the word (unless I missed some obvious documentation).

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 :: Stage Properties In Custom Class, Not Document Class?

Oct 14, 2011

I need to use stage.width/height in my CustomClass so I found some topics about it.

if (stage)
{
init(ar,firma,kontakt,oferta,naglowek,tekst,dane);

[code]......

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 :: 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 :: Accessing An Object Drawn On The Stage In One Class From Another Class

Jan 6, 2011

I have created a class, call it Class1, that has various objects drawn on the stage (drawn in the IDE). It also has a function, called setColour, for changing the colour of those objects. The function works fine if I call it from within Class1.

Now I have another class, call it testClass1, that imports Class1 and calls the setColour function. First of all, none of the stage objects from Class1 are visible. Secondly, when setColour tries to modify the colour of an object, I get the error:

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

This is the code for testClass1:

ActionScript Code:
package
{
import flash.display.*;

[Code].....

So, what is the problem? Is it possible to change objects that are drawn on the stage of an imported class?

View 3 Replies

ActionScript 3.0 :: Accessing The Stage From A Class Which Isn't The Document Class?

Jul 3, 2009

I'm being really dumb today and I know this should be simple.....How do i access the stage from a class which isn't the Document Class? For instance, I want to create a tween which takes in the parameters of the stage's width? So I've written.....

ActionScript Code:
var myTweenX:Tween = new Tween(this, "x", Regular.easeOut, this.x, stage.stageWidth, 60, true);

[code].....

View 4 Replies

Accessing Stage From A Class Which Isn't The Document Class?

Jul 3, 2009

How do i access the stage from a class which isn't the Document Class? For instance, I want to create a tween which takes in the parameters of the stage's width?[code]

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 :: Arrays: Linking A String To Objects On The Stage?

Jan 20, 2010

I have a string array with a list of words,e.g. var textArray:Array = ["a1", "b2", "c3", "e5"]Then I also have an array with a list of buttons that are visible on my stage,e.g. var objectArray:Array = [a1_btn, b2_btn, c3_btn, d4_btn, e5_btn]m wanting to use actionscript to make the buttons that are writen in the text array to be visible onscreen, and the buttons that arn't written in the text array to be invisible.

View 4 Replies







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