ActionScript 2.0 :: Flash 8 - Using A Variable To Target A Movie Clip

Apr 15, 2012

It doesn't really seem to say anywhere which version of Actionscript he uses, but at least it seems to show that what I'm trying to do is possible for someone, which is a start.

I'm trying to do exactly what he describes--I have several squares on a grid that are numbered, eg. grid_0101, grid_0102, grid_0103, and so on, for about 100 squares altogether, and I want to be able to target a given square dynamically.

This is the basis of the code I started with:

Code:
var digsquare_x:String = "01";
var digsquare_y:String = "03";
var digthis:String = "grid_" + digsquare_x + digsquare_y;
this[digthis]._alpha = 50;

I don't need to change the alpha specifically, I was just trying to see if I could get it to affect a given square in any way, and apparently the answer is no. I know that the value of "digthis" is accurate, but even blatantly telling it to refer to _level10[digthis] still gives me no results. Neither does _root.level10[digthis] which I tried just to see if it would work.

View 9 Replies


Similar Posts:


ActionScript 2.0 :: Using A Variable To Target A Movie Clip?

Jul 29, 2010

I found this tutorial which seems to do exactly what I'm trying to do (the only one I've found to date), except his technique doesn't seem to work for me at all. It doesn't really seem to say anywhere which version of Actionscript he uses, but at least it seems to show that what I'm trying to do is possible for someone, which is a start.I'm trying to do exactly what he describes--I have several squares on a grid that are numbered, eg.grid_0101, grid_0102, grid_0103, and so on, for about 100 squares altogether, and I want to be able to target a given square dynamically.This is the basis of the code I started with:

Code:
var digsquare_x:String = "01";
var digsquare_y:String = "03";

[code]......

View 2 Replies

ActionScript 2.0 :: Load Movie Clip Into A Target In Flash 8?

Aug 6, 2010

I have 3 movie clips. I want to load these mc (a simbol, Not xx.swf file) to 3 specific places in my frame by default by clicking a button at the same frame. How to load these mcs to these places?

View 2 Replies

ActionScript 3.0 :: Target One Movie Clip From Within Another Movie Clip?

Jan 21, 2010

I have two movie clips on stage: mc1 and mc2.Within both movie clips, there are 10 frames, all named frame1, frame2, etc.In "mc1" there is one button on each of the frames named btn1, btn2, etc.I'm trying to get it so when a button is pressed, (mc1.btn1 or mc1.btn10) it causes the other movie clip to advance to a certain frame.I've tried this code within the mc1 clip, on the same frame as the button:[code]But get a 1119 error. (Access of a possibly undefined property mc2 through a reference with static type.

View 1 Replies

AS3 :: IDE - Target One Movie Clip From Another?

Apr 16, 2009

I have two movie clips on my main time line. There is a button in movie clip 1 that I want to target to movie clip 2... and it's not working for me. I'm assuming that when I'm in movie clip 1, I need to tell it to go back up to the main time line, and into the movie clip 2.The site that does the same exact thing I'm trying to do is this tutorial:The buttons and the page area are two seperate movie clips, but the buttons in the button movie clip target to the page area movie clip.This is the code that I'm thinking I'm getting an error with:Code:MovieClip(root).eyecarePage.gotoAndPlay(10);- where eyecarePage is the Instance Name of the movie clip where I want the button to target to, and once it's in that movie clip, I want it to go and play frame 10 and on... but instead I get a #1009 error.

View 4 Replies

ActionScript 3.0 :: Cannot Target A Movie Clip Name

Jul 14, 2009

[Code].....

So the display list seems to indicate that I have 6 movie clips on the stage. PROBLEM: When I try to target the movie clips by name in adding the following code for example: image2.apha = 0; I get an error: 1120: Access of undefined property image2. What I don't get is: image2 is a movieclip and a movieclip has a property of alpha?

View 3 Replies

ActionScript 2.0 :: Target A Movie Clip In MX?

Oct 31, 2002

Seeing that the tellTarget function has been "deprecated" (I don't see why), how can I target a movie clip?I have a button on a frame on the main timeline, which I want to link to a movie clip that has been placed in another frame (still on the main timeline).

View 1 Replies

ActionScript 3.0 :: Can't Target Parent Movie Clip

Feb 17, 2010

I have a swf which contains a main menu bar along the top which has been added dynamically at run time. ALl the controls for this bar live inside btnHold One of these buttons loads in a new swf. There is a button within this second swf that I want to use to control the main menu bar in the top layer (I want to make it invisible for a time, or get its layer and then ensure that its not too high etc etc)However, I just can't work out how to target this btnHold from within the newly loaded swf.

View 2 Replies

ActionScript 3.0 :: Target One Movie Clip From Another Using Buttons?

Apr 11, 2011

Im just learning AS3 and am having some problems finding the answers to what I need so im trying here. I have two movie clips on my stage.

movie clip #1 (instance name "menu_mc") has a button inside it with the instance name of "btn1_mc" and the following code (what i have as of right now...need click function) on frame 1:

[Code]...

View 3 Replies

ActionScript 2.0 :: Target A Frame In Movie Clip?

Mar 10, 2005

How do i target a frame in a movie Clip. I'm using the loadmovie command and want an alternative pathway through the site. That is, when user cliks button they go to frame 15 instead of frame 1.

View 2 Replies

ActionScript 3.0 :: Target A Movie Clip Like So :trace?

Jun 2, 2009

It's about targeting movie clips... In AS2, you just target a movie clip like so :trace (FirstMc.ChildMc1.ChildMc2.ChildMc3._x) // Will send out the x position of ChildMc3 But is AS3, i see that there's a function called getChildByName('put child name here'). But what if it's such a long way to go to that child??? Does it have to be:

FirstMc.getChildByName("ChildMc1"). getChildByName("ChildMc2"). getChildByName("ChildMc3").x

That just seems to tedious and I'm sure Adobe thought of a clean way of targetting??

View 11 Replies

ActionScript 2.0 :: Target A Frame In A Movie Clip?

Mar 10, 2005

How do i target a frame in a movie Clip. I'm using the loadmovie command and want an alternative pathway through the site. That is, when user cliks button they go to frame 15 instead of frame 1.

View 2 Replies

Professional :: Reusing Movie Clip As Target For Loading

May 23, 2010

If I use an empty movie clip to load a series of images into,how do I get them to load in the center?The images are all different sizes.I think this is fine, if they loaded with the center of both the target clip and the image aligning.Upper left registration point for the target is not good.

View 10 Replies

Actionscript 3 :: Bring Current Target Into Movie Clip?

Oct 15, 2010

How to bring the current target into the movie clip?

If we can set the current target into "selectMovieClip" variable then i believe we should be able to rotate or manipulate it as a MovieClip.[code]...

View 1 Replies

Actionscript 3 :: Target Movie Clip On The Stage From Doc Class?

Dec 17, 2010

I am making dynamic drag and drop game.I have a class for the dragged items containing the drag drop code.My problem is I can't call/access the movie clips I've already put on the stage in my hit test statement.Here is my code and target1_mc & target2_mc are the existing movie clips on the stage:

package {
import flash.display.MovieClip;
import flash.events.MouseEvent;

[code]......

View 1 Replies

ActionScript 3.0 :: Event Target Inside A Movie Clip?

Apr 29, 2010

How can I target an event target that is inside a movie clip?

portfolio_mc.landingBtn1_mc.addEventListener(Mouse Event.MOUSE_OUT, landingRollOutFunc);

ActionScript Code:
function landingRollOverFunc(myEvent:MouseEvent):void {
TweenMax.to(event.target, .2, {scaleX:1, scaleY:1});[code]..........

//This obviously doesn't work but it will provide an idea of what I'm trying to do:

function landingRollOverFunc(myEvent:MouseEvent):void {
TweenMax.to(MYPARENTCLIP.event.target, .2, {scaleX:1, scaleY:1});
}

View 2 Replies

ActionScript 3.0 :: Use A Movie Clip As An Xml Target To Load An External Swf Through The Xml?

Aug 15, 2011

I want to know if and how I can use a movie clip to give the coordinates to load an external swf in an exact location, through an xml file?What I have is an xml menu and instead of opening web pages, I want to load external swf files in the same swf, where the menu is located, the thing is I don't know how to give the coordinates in the target of the xml file, and I want to know if and how I can use a movieclip to do this, such as _parent.mc.loader.

View 1 Replies

Actionscript 3.0 :: Target A Movie Clip From The Main Timeline?

Apr 5, 2010

I have 7 buttons on the main stage that go to different parts of the main timeline, all of which have the same movie clip with 7 different frames. Right now it always goes to the first frame of the movie clip, but I need the second button to go to the second frame, and so on. I was originally trying to have the button itself find a frame label inside the movie clip, but now I realize I probably need to attach something to the key frames of the main timeline that tells it to go to a specific part of the movie clip. The problem is I can't figure out how to address the movie clip from the main timeline. The book I started learning from had a short section on declaring movie clips, and I cobbled together this bit of code and put in on a key frame in the main timeline.

Code: Select allvar viewwork:MovieClip = root.viewwork

viewwork.gotoAndStop(2);

I'm pretty sure that's completely wrong, as it gives me the error: 1119: Access of possibly undefined property viewwork through a reference with static type flash.display:DisplayObject.

So how do I properly reference a movie clip from the main timeline? Also, I'm using an external .as file for most of my actions, but I'm sticking this directly on the frame because I haven't even thought about trying to figure out how to target a specific frame from an external file. Is that going to cause problems?

View 1 Replies

ActionScript 2.0 :: Target Movie Clip Only Moves One Pixel?

Sep 1, 2005

I have a movie clip that I would like to slide to the right or left depending on which button the user clicks. When I test the movie and click on the buttons, the target movie clip only moves one pixel. I want it to slide into place. What am I doing wrong?

[Code]...

View 4 Replies

ActionScript 3.0 :: Drag And Drop Movie Clip On The Target

Apr 13, 2009

I have a draggable movie clip that contains a button inside to hold my code. The target area is in the root and is a movie clip. I need to be able to drag and drop on the target. When it does drop on the target it needs to play a different keyframe from the root which holds a movie clip. Below is the code I have in my button within the draggable movie:

[Code]...

it starts dragging, but for some reason the drop target isn't working or the stopDrag, because it won't stop dragging.

View 3 Replies

Flash :: AS3 Add Movie Clip To Stage Using Variable Which Holds The MC Name

Dec 1, 2010

how to add a movie clip to the stage from the library but i'm strugling to do it when the I need to load a movie clip from the library when the name of the movie clip is held in a variable.

for(var i:Number = 0; i < 64; i++)
{
var blueIconS:blueIcon = new blueIcon();
addChild(blueIconS);

[Code]....

The above code works for adding the blueIcon but I have a variable in that loop which tells which icon to load.

sectorsMCs[jewelsIDs[i]]

The above will tell me what MC name to load but how do I load a MC from library by that variable value?

View 1 Replies

AS3 :: Flash :: Access Variable Of Parent Movie Clip?

May 24, 2011

How to access variable of parent movie clip in child movie clip in Action script 3.0

View 1 Replies

Flash :: Access Variable In Added Movie Clip?

Sep 30, 2011

I'm in class file right now and made a new movie clip using the linkage name

var mc = new ExampleLinkageName();
addChild(mc);

all good, I can see mc on the stage. In the ExampleLinkageName movieclip, I have a variable defined in it (on the physical timeline) called test.

In my class, I try trace(mc.test) and I get null. how I can read that variable?

View 1 Replies

ActionScript 3.0 :: Drag And Drop - Target Movie Clip Control?

May 4, 2011

Here is what I am looking to do.  Currently I have a drag and drop built in AS 3 that works perfectly fine, but I'm looking to add one more functionality.  What I want to happen is when I drop the correct drag item on it's correct target piece (which is a movie clip) I want my target movie clip to go a head one frame.
 
So as an example I'm dragging a piece of paper onto a movie clip of of a waste basket.  When I drop the piece of paper on it the waste basket, the waste basket movie clip moves a head one frame which shows a crumpled up piece of paper in it. Here is my current code for my drop eventlistener:
 
function dropMe(event:MouseEvent):void{ event.currentTarget.stopDrag(); if(event.currentTarget.hitTestObject(event.currentTarget._targetPiece )) {  event.currentTarget.x = 950;  event.currentTarget.y = 100;  event.currentTarget.removeEventListener(MouseEvent.MOUSE_DOWN, dragMe);  event.currentTarget.buttonMode = false;  } else {  event.currentTarget.x = event.currentTarget._origX;  event.currentTarget.y = event.currentTarget._origY; }}

View 1 Replies

ActionScript 3.0 :: Target One Movie Clip With Event Handler Function?

Oct 19, 2009

I created an array with movie clips now how can i target one movie clip with event handler function . so that when i clicked on one movie clip a message should be displayed

View 4 Replies

ActionScript 3.0 :: Refer To Movie Clip In Parent That Includes Target.name?

Nov 18, 2009

I am writing code in a MovieClip and want to refer to another MovieClip that shares the same parent.it'll be MovieClip(parent).theOtherMovieClip.But I want to refer to the MovieClip using the current MovieClip's instance name + "txt." This was my guess at the code, but it doesn't work.

MovieClip(parent).MovieClip(this.target.name+"txt" )

This didn't work either

MovieClip(parent).this.target.name+"txt"

View 1 Replies

Actionscript 3.0 :: Target Child's Attribute Nested In Movie Clip?

Apr 2, 2009

I have a Movie Clip called panel that I have added three children to (points, answer, question). I need to know how to access the alpha property of each child so that on a ClickEvent I can change the alpha so that the appropriate one is showing.[code]

View 8 Replies

ActionScript 2.0 :: Target Path To Movie Clip Element Of A Button?

Jul 16, 2004

I'm trying to figure out how to use AS to access frames of a movie clip within a button symbol (using Flash MX 2004), and I seem to be stuck. I drafted a small test version of the FLA I'm working on, and it is attached to this message.

Specifically, my intention is to have a two-state button that goes into "selected mode" after the first mouse click, and then goes back to normal after a 2nd click. I can already handle the functional aspect of this using a global boolean like the one in the attached file. The problem is that I want to represent the current status of the button with a visual change; in the attached example FLA, the intention was to change the color of the text label on this button from grey to red when the button is in its "selected" state.

In this forum I found a similar question where someone had provided a "menu.fla" that had a row of buttons that acted more or less like a radio set, which is somewhat similar to my need. I've been trying to use the same sort of method, having converted the "up" state of the button text into a movie clip symbol with two frames (one for each state), and then trying to use AS to do a "gotoAndStop()" on the desired frame of the up label animation. The problem is that I cannot figure out how to actually make this work ... no matter what sort of path I try to use to get to the movie clip animation within the button, I cannot seem to set the text animation to jump to the "selected" frame (2).

I think my problem is that I've been unable to glean any understanding from the Flash MX docs about the differences between an object name and a symbol name and an identifier and an instance name and a blah blah blah, or about which of them (if any) actually is an ID that can be accessed via ActionScript. Also, MX 2004 seems to provide almost no compile-time error checking on the validity of a target path either, so I've been reduced to just throwing every combination at it that I can think of. None have worked, so I'm at a loss.

If anyone can explain to me why the attached FLA doesn't cause the text to stay red after a mouse click, no matter which of the commented out lines I try, it would undoubtedly be a big help to me.

(Please note that the button in this FLA uses a basic flashing animation for mouseovers ... it was just something quick to implement to emulate the mouseover animation in my full file, so please don't be distracted by it. Also note that I haven't tried to implement any code to return the button to a non-selected status yet. One thing at a time.)

RESOLVED: It was apparently the nesting of a movieclip inside of a button that prevented the original target path from working (and one of the tutorials at this website seems to support that). Once I knew what the proper path syntax was and didn't have to worry about that part anymore, eventually the rest fell into place pretty easily once I started using a movieclip for the button rather than an actual button.

View 3 Replies

ActionScript 2.0 :: Target A Movie Clip On A Different Frame From The Scripted Button?

Dec 22, 2007

I started working actionscript 2 yesterday for a uni project. I was wondering if I can target a movie clip on a different frame from the scripted button. For instance would:

//
_root.my_mc._width
//

return defined if my_mc was on a different frame?

View 2 Replies

ActionScript 3.0 :: Drag And Drop Using A Target Area On Movie Clip

Mar 15, 2011

I am trying to create an application for students to visualize their course schedules.I have rectangles representing each class, which students can drag and drop to build their schedule.I would like the students to be able to type in the course number and name before adding it to the schedule.I have the drag-and-drop working, and editable text working. owever, when I try to edit the text, it drags the box as well.Therefore, I would like to be able to limit the "drag" functionality to one corner of the rectangle.So the user would have to click that part in order to drag the movie clip. Please see the attached image to get a better idea of what I'm talking about.

View 5 Replies







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