ActionScript 2.0 :: Targeting Instances With Variables

Jul 9, 2009

I am working on building a menu of seven buttons (movieclips). When you click on one, it turns it blue. When you click on another one, the previous one needs to revert back to green.What I'm doing is, when you click on the buttons... it loads a number (1-7, depending on the button) into a global variable (menuActive). That variable is then referenced to check which button needs to be turned green when you click on the next button.[code]I have two problems:

1) It doesn't seem to be appending the value of 'a' to the targeted instance name correctly. (If I replace _parent.mcBtn+a with _parent.mcBtn7, for example, it works fine.)

2) It also seems to be keeping the "this.gotoAndPlay("btnOn"); parts from working properly.

View 3 Replies


Similar Posts:


Actionscript 3 :: Targeting Unnamed Timeline Instances?

Dec 31, 2011

Is there any way to control nested MovieClip instances placed on the timeline without naming them through the Properties panel? Are there any unique identifiers I can refer to?

Using instance names (like instance33, instance12, etc.) doesn't help since names are just properties, but how about references like sprite187_27 (as returned by trace(this) inside a MovieClip on the TimeLine)?

(Using ActionScript3, Automatically declare stage instances disabled)

View 1 Replies

ActionScript 3.0 :: Targeting - Dynamically Create A Few Instances Of The ComboBoxButton To Function As The Drop Down Submenu

Jun 24, 2009

I've created an MC in my library (comboBoxButton) which holds 2 MCs, text_mcl and bg_mcl. I dynamically create a few instances of the comboBoxButton to function as the drop down submenu: PHP Code:

[Code]...

When one of the buttons is selected it sets a variable on the root. I'm running into trouble targeting the MCs text_mcl and bg_mcl inside the instance of the dynamically created comboBoxButton. PHP Code:

[Code]...

View 1 Replies

ActionScript 2.0 :: Targeting Instances - Attaches A Movie Clip To The Stage Each Time At A New Level?

Jul 28, 2008

I have a function that attaches a movie clip to the stage each time at a new level.

myLevel++
attachMovie("myMovieClip", "instanceName"+myLevel, myLevel)
}

At the moment it works just fine but I want to target specific instances and I can't work out the instance names.I am trying this..

instanceName[myLevel]._x = 400

View 9 Replies

ActionScript 1/2 :: Targeting Variables On Different Timelines

May 7, 2011

Flash CS4, ActionScript2.0 -  I have a button and an input text box in a movieclip.When the button is clicked, I need the movie to jump to a frame on the main timeline and have the text that was entered into the input box in the mc, show up in a dynamic text box in the frame on the main timeline.I finally got the movie to jump using 'with (_root) gotoAndPlay ("frame label"), but I can't get the input text value (in the mc) assigned to the dynamic text box (on the main timeline).I've tried several versions of relative and absolute paths in the assignment statement, using variable names and instance names, tried 'with' and 'this' but no matter what I do, nothing shows up in the dynamic text box.

View 8 Replies

ActionScript 3.0 :: Passing Variables Or Targeting Array Instance

Oct 8, 2008

I can get the variable into Pages.as now but the Loader will not "reload" hen the button is clicked.

View 35 Replies

ActionScript 2.0 :: Using Variables As MovieClip Instances?

Jan 14, 2006

I'm having some trouble trying to duplicate movieclips randomly. I have created an array with the instance names of the MCs i have on stage. Then I'm trying to create a variable that selects one random element from the array. Finally I want to use that variable as a target to duplicate my movie Clips... but it doesn't work.

Here is the code:

Code:

var Items = new Array('bombon', 'regalo', 'corazon');
pos = new Object();
pos._x=random(550);

[Code]....

View 5 Replies

ActionScript 3.0 :: Assigning Unique Variables To Movieclip Instances?

Apr 10, 2009

When one creates several instances of a movie clip on the main timeline, how can one assign separate variables to each of these instances and then invoke each of these values from the main timeline? I know how to do this by creating a separate movieclip and putting code on that movie's timeline (using 'this'), but I always feel this is sloppy because I'd like to keep my code all on one timeline.Here's some example code. It creates three instances of a movie clip, and assigns each one a variable called 'contImage' which contains the source of the loaded image. How can I get this variable traced when each of these images is clicked?Even though, as I said above, I have a work around, it has stuck in my craw for a while now.

Code:
var photos:Array = new Array('images/1.jpg', 'images/2.jpg','images/3.jpg');
for(var i:int = 0; i < photos.length; i++)

[code].....

View 6 Replies

ActionScript 3.0 :: Defining Values Of Variables For Classes, Subclasses, And Instances?

Jan 5, 2010

how subclasses,instances,and inheritance work. The below code isn't actual project code, it's theoretical code, generalized to a simplistic level so that we can talk about the big issues.Let's say I have animals_app.fla, with a "Dog" class MC and a "Cat" class MC. Both "Dog" and "Cat" are subclasses of "Animals"; animals_app.fla uses document class "Main".

Intuitively, I think Animals should declare that every subclass should have some animalSpecies, and each subclass will define the value of its own animalSpecies. It wouldn't make sense for Animals to provide any default value, because it will always be different per subclass. Is this correct? I had tried out some code similar to that below, and was perplexed because it seemed like whenever a subclass tried to define a value for its own animalSpecies variable, it was actually changing the value of the variable in the Animal class, but that's not what I want. How do I rewrite this code so that each subclass defines the values of variables it inherits from its superclass, without altering the superclass? And how would I define the value of variables for each instance of a class, so that I'm only changing the values of that instance, without altering the subclass?

Animals.as

Code:
package
{
import flash.display.MovieClip;[code]..........

Also, conventionally, what should be in my Main class? Only the addChild code which attaches MCs to the stage? Or should the values of variables be defined in Main? What am I missing? I recently read Foundation Game Design with Flash and didn't feel like the explanation was sufficient. I've tried scouring the web for OOP tutorials, but they're either too basic or too far over my head.where I should be defining values of variables for classes, subclasses, and instances?

View 1 Replies

ActionScript 3.0 :: Access Relative Variables Of Movieclip Instances From Root Or Other Movieclips

Feb 1, 2010

In AS3, how can you access a relative variable within a specific movieclip on the stage?I have a test file that changes the variable "myVar" in one of the displayobject movieclips drawn on the stage. I want to simply trace the current value of this displayobject's myVar for additional purposes.In AS2, you would achieve this by calling the instance name and then the variable contained within.Assuming 3 movieclips existed on the stage named Container1¯, Container2¯ and Cotainer3¯trace(_root.myContainer2.myVar);// returns Hello which is value of variable "myVar" within the movieclip instance named "Container2".How would you do this in AS3?[code]

View 6 Replies

ActionScript 2.0 :: Targeting A Mc With Within A Mc?

Mar 2, 2006

I have made a navigation that is a movieclip, now within the movieclip are 6 movieclips that are the "buttons" of the navigation. This is then placed on the maintimeline as the movies navigation. When one of the "buttons" is pressed i want it to go to a specific point on one of the 6 movieclip "buttons" timeline. This is the code that I have used before on the maintime line to target a movieclip there... but never a mc within an mc. First, would I still place this code on the maintime? or within the mc that the 6 mc buttons are placed? Second how would I target the nav buttons mc's?

stop();
but1.onRelease = function() {
this.gotoAndStop(9);

[Code]....

View 2 Replies

ActionScript 2.0 :: F8 Targeting Gets Lost

Jan 15, 2009

I've got a dynamic textfield clip which is placed twice on the stage. It also includes a button. Funny thing is, the first trace works (tracing its _y value: 0 for clip 1 and 200 for duplicate clip 2). When I press the down button of both clips however it traces undefined though it's the same line. How does onPress mess up the targetting of both clips? [code]

View 6 Replies

ActionScript 3.0 :: Targeting A Loaded Swf

Nov 11, 2009

1. I'm loading an external swf onto my main swf.
2. Then I'm tweening an object which is separate to the loaded swf.
3. When the tween has completed I'm calling a function to make the loaded swf gotoAndPlay(2);

[Code]....

View 8 Replies

Targeting Label In External SWF?

Feb 12, 2010

I have 2 SWF (swf1 and swf2). I want to load swf 2 into 1, but getting it start on a label or a particular frame.I use this to load SWF 2

Code:

on(release){
loadMovie("movie2.swf",0);
}

How do i target it to start from a label in a scene from movie2.swf?

View 3 Replies

ActionScript 3.0 :: Targeting MC Already Placed On Stage?

Apr 28, 2011

I'm trying to target an MC that is already placed on the stage (as opposed to adding it from the library).

But I get this error:

Quote:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at com::Test()
at objects_fla::MainTimeline/frame1()

[Code]....

View 5 Replies

ActionScript 3.0 :: Targeting An Instance Of A Mc?

May 27, 2009

With AS2 I u sed to do  createEmptyMovieClip("name"+i, to create multiple instances of an mc. I ocuuld then target these individual instances

[Code]...

View 4 Replies

ActionScript 3.0 :: Targeting An Event From A Different MC?

Feb 4, 2011

I made a  play/pause button for this project I'm working on (basically a slideshow with a different movieclips on each frame) and I have managed to get it to  target either the main timeline or a nested MC. The problem is with the  code I have is that the button will only work for one MC at a time. This  means I will need a separate play/pause button for each individual  slide. Is there some way to make a button that globally starts and stops  any MC without effecting the main timeline?
 
Here is the code I am using now:
 
stop(); 
pause_btn.addEventListener(MouseEvent.CLICK, stopplaying);function stopplaying(event:MouseEvent):void {    MovieClip(parent).green.stop();    gotoAndStop(2);}
 
Ned proposed adding an event at the beginning of each movie clip and programming the play/pause button to work that way. My problem (after spending a lot of time with it) is that I can't get my play/pause button (a MC itself) to target the event in a separate MC. 
 
This is my event placed on the first frame of my movie clip:
 
dispatchEvent(new Event("imHere"));
  
This is the code I have in the play/pause button that doesn't work:
 
stop(); 
pause_btn.addEventListener(MouseEvent.CLICK, stopplaying);function stopplaying(event:MouseEvent):void {    gotoAndStop(2);}

[Code]....

View 8 Replies

ActionScript 2.0 :: Targeting SWF From Another One In ECard

Jul 31, 2009

I am building an ecard, and I created two swfs. The first swf is the actual ecard, with a dynamic text box that is going to display the message. The second swf is where you would actually type in the information, such as name, email, and message. Is it possible for two swfs to "talk" to each other inside an html document? Also, I am not quite sure how to send the card to someone's email. I am assuming that when you hit SEND it reads the input box with that email, but not sure how that works.

View 1 Replies

Actionscript 3.0 :: Targeting A Mc In A Different Timeline?

Dec 30, 2009

I have a main.fla which has 3 movieclips inside it. All 3 mc's have timelines that run 40 frames. The main.fla timeline has each mc instance on a frame.

mc_1 is on frame 1
mc_2 is on frame 40
mc_3 is on frame 81

as the main timeline plays the clips each one fades to the other.

I need to know how to target this scenerio

after mc_3 plays I need to have a goToAndplay (frame) set up so the animation inside mc_1 starts playing (frame 20) of mc_1.

I know how to do off a button

but there is no buttons, the action needs to happen when the playhead reaches the last frame of the main timeline in main.fla

View 2 Replies

ActionScript 2.0 :: Targeting External .swf's?

Oct 5, 2004

targeting external .swf's.I am trying to load external movies to a main movie in a branched manner (i.e. root -> first movie has buttons to load second -> second movie has buttons to load third) in specific areas on the main movie.

In this simple flash im trying to get the main-button to load onto the main movie. Once it loads, a button appears and replaces the black square. When you click on it a series of other buttons appear on the side and replace the red square. Once those buttons appear, when one clicks one of them a small movie loads into the blue square and replaces it.

View 3 Replies

ActionScript 2.0 :: Targeting Loaded .swf?

May 1, 2003

this code is working to load and position the external swf, but it won't gotoAndPlay to the frame inside the external swf--what am doing wrong here?

PHP Code:

bio.onPress=function()[code]......

View 3 Replies

ActionScript 2.0 :: Targeting A Nested MC?

Jul 13, 2006

I am creating a drop down menu and having problems adding problems to the nested MCs. I have all the actions on the root timeline and I have a one Main_MC which holds several Sub_MC's.I have the Main MC animated fine but I can't find how to control the Sub-MC's.Here is a sample of my code and I have tried _root. and this. and show below but I can't get it to work.

//main MC
Main_MC.onRollOver = over;
Main_MC.onRollOut = out;[code].....

View 9 Replies

ActionScript 2.0 :: Targeting Function Within MC?

Jul 14, 2006

I am trying to start and stop an animation from outside of the main timeline. I have written the functions inside the movie to start and stop the animation and they work fine when called from within the movieclip but when I call them from the maim timeline I get nothing. I have checked the targeting is correct and can't think what this is

View 6 Replies

ActionScript 2.0 :: Targeting A Fame?

Jun 19, 2003

i have three MC's 1,2,3 and a button for each of them, on pressing each button it makes the appropriate MC play half way then stop at a frame with a stop action. BUT what i want is to use a if statement something like this

script is on MC1 button

tell MC1 to play ();
if MC2 is at frame xx
tell it to play ();

eles do nothing

View 4 Replies

ActionScript 3.0 :: Targeting A Button Within A MC From Another MC?

Jan 5, 2010

I know what the error 1061 means, but have no idea how to fix it. I've tried to correct it a million & one ways...

Code:
1061: Call to a possibly undefined method getChildByName through a reference with static type flash.display:DisplayObject.

I'm trying to target a button named 'mcTargetButton' (a SimpleButton) that's inside a movie clip called 'mcTargetParent' from a movie clip called 'mcCallFromThisClip'.

Both clips are on the main timeline. Note, I am using a document class... if I trace (this.parent) from 'mcCallFromThisClip' it prints the name of the document class.

[Code].....

how hard should it be to reach a button from a different movie clip?

View 1 Replies

ActionScript 3.0 :: Geo Targeting In Flash?

Feb 23, 2010

Something has come up where we may need to do some geo targeting to deliver different content to a video player based on the client's (as in end-user) location. Basically, we would want to control the delivery based on country. This sounds like a huge, deep topic that I can't even begin to address. Anyone have any thoughts or experience doing this sort of thing with Flash content?

The swf may need to sit on a server we have no back-end access to, so ideally it would be a solution that doesn't require PHP or any other sort of back end...but I'm not sure if that's possible.

View 2 Replies

ActionScript 3.0 :: Targeting MC Inside Of MC?

Mar 12, 2010

I have 10 MC that are generated inside of a for loop. Each MC got another MC inside of it that is already sitting on the stage and has it's own instance ame applied! After that I put them inside of a MC container, that I also add dinamicly through the addChild method! But I have one issue when I want to change the position of the child MC(one that is sitting on the stage), through targetting to it's instanceName! The code I use:

Code:
var box1_mc:Box1 = new Box1();
var ball1_mc:Ball1;
var balls:Array = new Array();

[Code].....

View 1 Replies

ActionScript 2.0 :: Targeting Objects Between Swf's?

Jan 28, 2011

So i have multiple swf's that are within a stage. The main swf (index.swf) has a menu and once clicked it makes another swf to display. A common issue i'm having is that for the other swf's. I have animations which work within that swf but when i run from index they don't work.I know this is because of the targeting of the object but how do make this work?ample on 5.swf i have a button that has an action, when a mouse cursor goes over it a photo fades in and out on it, and that works when i run 5.swf

View 9 Replies

ActionScript 2.0 :: Targeting A Scene From One Swf To Another?

Nov 11, 2003

what is the syntax of targeting a scene from one swf to another? lets say i have a 2 swf file and i want to target a scene frm the second swf file named "games". tnx

View 14 Replies

ActionScript 2.0 :: Possible To Targeting External .swf's?

Oct 5, 2004

I am trying to load external movies to a main movie in a branched manner (i.e. root -> first movie has buttons to load second -> second movie has buttons to load third) in specific areas on the main movie. In this simple flash im trying to get the main-button to load onto the main movie. Once it loads, a button appears and replaces the black square. When you click on it a series of other buttons appear on the side and replace the red square. Once those buttons appear, when one clicks one of them a small movie loads into the blue square and replaces it.

View 3 Replies







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