ActionScript 1/2 :: Calling A Variable In An Instance Name?

Mar 16, 2012

Basically I'm creating a question with 4 answers (i.e. a,b,c,d).I have my question working fine, but I'm having a problem adding a check mark beside the answers once the user clicks the submit button.I've created four instances of my check mark; rightAns1_mc, rightAns2_mc, rightAns3_mc, rightAns4_mc.  I've set them all to _invisible = false; I've also set up a variable; nCheck:Number = 0; and when the user clicks one the radial buttons I have the variable change (i.e. if they click A, it set to nCheck = 1; if they click B, it sets to nCheck = 2; etc)So in my if statement for the submit button I figured I could have rightAns(nCheck)_mc._visible = true;

View 1 Replies


Similar Posts:


ActionScript 3.0 :: Create New Instance() When Instance Is A Variable?

Feb 12, 2012

I have a base class I've used on 6 different MC's. Then when I use these MC's my function runs an if statement to check which one to add.

if(id=design) var obj = new design();
if(id=team) var obj = new team();

I want to make it a bit more dynamic and use the id:String to evaluate which new instance to create.

ActionScript Code:
public function loadChapter(id:String):void {
var obj = new instance_of( id )();
}

View 5 Replies

Only One Instance Of Same Button Calling Function?

May 17, 2009

I have 4 instances of the same button on a single layer in a timeline of the mc 'coverflow_mc' named 'ThatsMe_btn_a' to 'ThatsMe_btn_d' ie same button, same position.. it just changes instance name on 4 keyframes. Why does it call the function fine for button a but not for b,c, or d? There is a stop on each of these frames and I can see from the swf that it is stopping at the correct frames.
 
function thatsMe() {
right = new Sound();
right.attachSound("right");

[Code]....

View 3 Replies

ActionScript 3.0 :: Variable Of Null Value Assignment To A Variable Or Instance Flash?

Jan 7, 2010

As we know whent here is no such variable of null value assignment to a variable or instance flash throws this kind of Error.In one of my Application i need to get more flashVariables, They may or maynot come as FLASHVARS. But when i miss any variable flash thows this error as an alert box. is there any simple solution to avoid this kind of issue
 
when i use try,Catch statement the issue will not come, But i don't like to write Bunch of try,catch statement for all this kind of variables.

View 4 Replies

ActionScript 3.0 :: Calling A Movieclip Instance From An Array?

Dec 14, 2011

I am creating movieclips into which I want to load thumbnails which are to be loaded dynamically. I'm not sure if the solution I am trying to build is the more effective way to do this; I'm still quite a noobie.

Each movieclip container which I will use hold the thumbnails is of a size to hold 16 thumbs, so the number of holder movieclips required is calculated at the time the xml loads; with the movieclips then being created, named and stored in an array. (The idea is to then move between these movieclips (and so the thumbs) using previous and next buttons) - however, I'm not at that stage yet!

However, when I call each movieclip to place the loaded thumbs in, the code throws the "#1010: A term is undefined and has no properties" Error. I think this is a problem with the array; and possibly the mc not being defined properly. However, I am not sure where my problem is.

[Code]...

View 7 Replies

ActionScript 3.0 :: Calling An Instance's Variables Directly?

Jul 21, 2009

I have two classes a main and one controlling a cloud graphic going on the stage. In the main class I am creating an instance of the cloud, adding it to the stage with an array and with a for loop I am setting the x speed (vx). I have noticed that if I set the vx in the cloud class and reference it directly then it does not work (clouds are drawn for a millisecond then a blank movie). I have to initialize the cloud.vx value in the main class to get it to work. Why can I not just pull the vx value from the cloud class without setting it to a value in the main class?

Main class

Code:
package
{
import flash.display.MovieClip;

[Code].....

View 14 Replies

Flex :: Calling A Static Method Of A Class With Only An Instance?

Jul 27, 2009

If all I have is an instance of an object, can I call a static method of its class? For fun, let's say I don't know what the name of the class is, only the name of the static method.

View 3 Replies

ActionScript 3.0 :: Create Class Instance Without Calling Constructor?

Feb 11, 2011

Is it possible to create an instance of a class without triggering the class' constructor?[code]In the case above, say I wanted to play around with a Foo instance, but I really don't want my global.foobarCount going up, nor do i want to pass in any value at all for bar.This could be useful for introspection where you want to learn more about or pass a particular class object but don't want to provide required arguments or trigger anything that the constructor may do.Is this at all possible? (Obviously, new Foo() just doesn't cut it here, since it would throw and arguments error, nor does just using Foo, since that's a reference to the class itself).

View 2 Replies

ActionScript 3.0 :: Calling A Static Method From A Class Instance?

Sep 21, 2011

My method has been passed a class instance, but it was typed through an interface so I'm not 100% sure what class it is. I'd like to attempt call a static method on that instance's Class.. is there an easy way to do this without being forced to pass the class along as well?

Something like this:

ActionScript Code:
public function foo(myBarInstance:IBar):void {
var barClassPointer:Class = getClass(myBarInstance);
try {

[Code].....

View 4 Replies

ActionScript 2.0 :: Calling A Variable From Php To Second Swf?

May 29, 2011

The website is build from a main swf file. "main.swf" which is basically the backround with menu and the first thing that opens in index.html. Then there is a second flash. called login.swf which is loaded onto the main flash.The second flash is loaded using next code:

Code:
cont._lockroot = true;
cont.loadMovie("login.swf");

[code].....

View 5 Replies

ActionScript 3.0 :: Calling New Several Times On A Variable?

May 2, 2009

What happens if I have a previously allocated variable (new), then I set such variable to null in order to mark it for GC but then a few seconds later I call new again on it (not knowing if it has been GCed), and the GC still has not cleaned the memory address containing the variable.Would the first (new) allocation be garbage collected

View 5 Replies

ActionScript 3.0 :: Calling Variable In One Function From Another

Dec 6, 2011

I have a function that has a For Loop inside it. Inside that For Loop I am defining a button and calling to another function if clicked. The issue is (since I shouldn't put functions inside other functions) how do I get the variable being processed in the For Loop to be considered in the function that was just activated by pressing the button.

Here's the code. All variable are defined elsewhere in the code.
function populateBox(DataInput:XML) {
linkAmount = DataInput.country[boxPartNum - 1].link.length();
/// defines amount of links being made
for (k=0; k<linkAmount; k++) {
myLink = new LinkClass();
[Code] .....
I need to trace the "K" used in the For Loop.

View 3 Replies

Actionscript 3 :: Calling A Variable Given Its String Name

Nov 29, 2011

var myvar = "this is the value of myvar";
var notMyvar = "this is some other variable";
var thirdVar = "this is some third var";
var nameOfVarToCall = "myvar";
//print the content of the var name specified, in this case "myvar"

I have a string which contains the name of a variable I need. What I want to do is find out the name of var (in this case "myvar") and use the name to access the value of the var (in this case just print out the value). Is this feature available in Actionscript. I know it's available in PHP and can come in very handy.

View 2 Replies

ActionScript 2.0 :: Calling A Dynamic Variable?

Sep 14, 2011

i have the following script, i'm just doing tests over failed attempts, I have a "cnc+i" dynamic variable, wich is a BitmapData type, i'm sure it's declared since the trace function returns true at the output, what i have a problem with, is at the moment of attaching the Bitmap, i don't know how to call it, and i don't want to do it manually like this: cnc1. Since i am planing on putting the attachBitmap inside a for loop:

ActionScript Code:
import flash.display.BitmapData;
this.createEmptyMovieClip("CNC",this.getNextHighestDepth());
CNC._x=50;

[Code].....

View 1 Replies

ActionScript 3.0 :: Calling Two Tweens Using Same Variable?

Dec 20, 2009

A very simple question. Can two tween events be called one after the other using the same variable name? (so that they occur simultaneously, no callbacks or anything like that).

Code:
var outTween:Tween;
outTween = new Tween(big_play_btn,"alpha",None.easeNone,1,0,1,true);

[code]....

View 6 Replies

ActionScript 3.0 :: Calling A Variable (tween) From Another Frame?

Jul 29, 2009

This is my first time working with flash and actionscript. when my project increased in size, it became frustrating to look through 2 or 3 hundred lines of code to find my mistakes. I decided to code in frames, so that one animation or movieclip could be handled by each frame, making it easy to edit each individually. So far so good, but i am trying to reuse a tween from an earlier frame, and it doesn't seem to work. I was under the impression that if you define a variable in a previous frame, you can use it in a later frame.

here's what it looks like

(frame 5)
var closeMenu:Tween = new Tween(mainMenu_mc, "x", Strong.easeOut, 238, 900, 3, true);

there is a frame in between that does: gotoAndStop(20);I want the animation to start right when it gets to frame 20:

(frame 20)
closeMenu.start();
TypeError: Error #1009: Cannot access a property or method of a null object reference.

I can copy and paste the original var and change the name from closeMenu to, say, closeMenu2 and it will work fine, but I feel like what I did should work.

View 0 Replies

ActionScript 2.0 :: Dynamically Changing Variable Calling?

Jan 27, 2011

Beginner question here. Basically I have the following code:

if (_root.obj1 == 1) {
n = _root.invArray.length;
_root.obje1._y = _root.inve(n)._y;

[code].....

View 1 Replies

ActionScript 2.0 :: Basics Of Calling A Function With A Variable?

May 27, 2011

I'm trying to get to grips with having a function that can accept an input that is passed to it as it is called, and then use that input in its workings.As I'm writing more code, it's becoming clear that this is something that I need to pick up, but despite reading and playing about with it, I'm still a little confused.The code is designed for a character's "level up" screen. When the button next to a stat is pressed, I want it to pass the name of that stat to the statUp function, which will increase the selected stat by one.In my main file I have this code, to call the function when the button is pressed. (In this example, it is the Strength button)

ActionScript Code:
_root.buttonStr.onPress = function()
{

[code]........

View 6 Replies

ActionScript 2.0 :: Calling A Function Based On Variable's Value?

Feb 16, 2005

say I want to declare a global variable in my main movie on a mouse event (button) and give it a value "functionA".

then I want to load an external .swf into a clip (with the same mouse event)

then I want some code in the loaded .swf to execute a function of the same name "functionA"

how would I code this?

this way I could load the same .swf but execute different functions depending on which button triggered the load... comprende?

View 5 Replies

Flash :: "Instance Name At Design Time" Vs "Instance Name Added Dynamically" Vs "Variable Name In Related Class"

Nov 4, 2011

Say i have a movieclip named a_Mc ( ClassA ) I have a sub-movieclip named b_Mc ( ClassB )

CASE 1: Accessing the sub-movieclip b_Mc which is already present inside the a_Mc movieclip

( Since Flash IDE has "Automatic instance naming" OFF )

ClassA mentions the name of b_Mc as => var b_Mc:MovieClip;

NOTE HERE: That the variable name MUST BE same as the name of the instance on stage.

So i can access it as : trace( a_Mc.b_Mc);

[Code]...

View 1 Replies

ActionScript 3.0 :: Calling A Variable From Inside A Movieclip In Flash CS4?

Nov 14, 2011

I am trying to trace a variable string from inside a movieclip which is inside another movieclip on the main timeline using:

[Code]...

View 6 Replies

ActionScript 2.0 :: Photo Gallery - Calling Variable From XML File

Apr 8, 2006

I have a photo gallery for a painter rotating through images via XML. She wants a little sold sign to appear on ones that have been sold. I'd like to figure out a way to make it appear/disappear with a _visible = true/false statement that I can call from via the XML file.

Something like:
<node>
<img>"img.jpg"</img>
<sold>true</sold>
</node><node>
<img>"img2.jpg"</img>
<sold>false</sold>
</node>

Is this possible? I know that may not be a correct syntax, I can't get it to work.

View 3 Replies

ActionScript 2.0 :: Pass A Variable To Function When Calling It With Interval?

Jan 30, 2009

How do I pass a variable to function when calling it with interval.

This:

Code:
doFlip(1);
to something like this:

Code:
myInterval = setInterval(doFlip(1),2000);

View 2 Replies

ActionScript 3.0 :: Calling Subclass Method Through Variable Typed To Superclass

Nov 26, 2008

It's early days in my AS3 learning, and I'm looking for a little clarification regarding a variable typed to a superclass (in this case var mySpinner:MovieClip) which contains a reference to an new instance of a subclass (in this case Spinner.) I am trying to get my head around why my code compiles and runs and I am able to call the method rotater() on mySpinner even though mySpinner is typed as MovieClip, and the MovieClip class does not contain the method rotater().

On page 163 of the official Adobe Programming ActionScript 3.0 documentation it says the following, which I believe is related to my situation, but I am still in need of clarification:
"Because each class defines a data type, the use of inheritance creates a special relationship between a base class and a class that extends it. A subclass is guaranteed to possess all the properties of its base class, which means that an instance of a subclass can always be substituted for an instance of the base class."

View 2 Replies

ActionScript 3.0 :: Flash - Calling Variable From Scene To Movie Clip?

Dec 9, 2011

tes is a movie clip.when i click zkanada button. movie clip will appear and play from frame 1.

Code:
//scene 1
var detail_temp:String=null;

[code].....

View 1 Replies

Actionscript 3 :: Calling MovieClip(root) From A Dynamic MovieClip Instance Produces Error 1034

Jan 14, 2012

For some reason, the same code works now, without any problem at all. I don't know what happened, or why, but I no longer have this problem Here's the original post: To put simply, I created a MovieClip, put it with addChild() to stage, and when I tried to call this piece of code:

[Code]...

View 2 Replies

ActionScript 2.0 :: Use Variable For An Instance Name?

May 6, 2011

Ok, I've been at this for 2 days now, and really need some assistance. It seems like it should be so simple!

The part that doesn't work [code]...

Then that button in the root should be able to take the value that is in the variable "critter_pressed_new" and use that as the instance name, to make that particular mc go away.

View 2 Replies

ActionScript 3.0 :: Using A Variable In An Instance Name

May 31, 2010

Simple question: I'm trying to use a variable to call on different instance names:

[Code]...

The code in red is the issue in question. In this example, I'm trying to add a child called "pic_2", with the number two called from the variable "picCaller"

View 16 Replies

ActionScript 2.0 :: Instance Name By Variable?

Jan 17, 2009

I have multiple inputs which I would like to limit the input on. Not limit to number of characters but limit to the actual input box. The problem is the limit script is not reading the variable I am sending to the function and is returning as undefined.

ActionScript Code:
function Limit(SetText){
oKey = new Object();
var __text0:String = "";

[code]....

View 0 Replies

ActionScript 2.0 :: Using Variable In Instance Name

Dec 3, 2009

I am trying to create an animation that will cycle through letters (each of which have an instance name) by using a loop. I have a variable which it outputting the numbers i need if just used in a tract but i want to add it to the end of the instance name so that each instance scales one after the other. Any way of delaying each one by a few few seconds (or milliseconds if I remember the acrionscript unit of time correctly).

View 3 Replies







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