ActionScript 3.0 :: Assigning X And Y Coordinates In Dynamic MovieClip

Jan 11, 2010

I cannot assign _x and _y coordinates in a movie clip dynamically. For example:
for (i=1; i<=5; i++) {
myThumb_mc = "thumb" + i;
myThumb_mc._x = Stage.width/2;
myThumb_mc._y = Stage.height/4;
}

But if I do:
thumb1._x = Stage.width/2;
this works.

View 3 Replies


Similar Posts:


ActionScript 2.0 :: Attaching MovieClip And Assigning It Coordinates Of Another Movie Clip

Sep 16, 2010

I'm making a game where an airplane loads using attachMovie, with a randomly assigned y coordinate and a constant x. The airplane then moves across the screen. You hit another button, and a parachutist is loaded using attachMovie, with the coordinates being set equal to the current coordinates of the airplane. The parachutist loads but he doesn't load to the coordinates of the airplane. If I feed the parachutist numerical coordinates, he loads to those coordinates, but for some reason Flash seems to be completely ignoring my attempts to feed the plane's coordinates to the parachutist. Here's the relevant code, which is of course nested in an onEnterFrame function:

if (Key.isDown(Key.DELETEKEY)){
if (jumped == false){
attachMovie("jumperWhole", "jumper", 0);

[Code].....

As I've said, the jumper loads, he just loads in the upper corner of the game, as if the plane's coordinates are ignored and Flash attaches jumper to the default coordinates of the program. If I try to attach the jumper to the using the coordinates of something that's not in motion, it works, so I'm wondering if this has something to do with the motion of the plane.

View 1 Replies

ActionScript 2.0 :: Assigning Actions To Dynamic MovieClip?

Mar 31, 2005

Assign actions for a mc created dynamically?

View 3 Replies

ActionScript 3.0 :: Assigning StartDrag XY Coordinates?

Feb 26, 2010

I'd like to figure out how to get these four skulls to move on a constrained X axis on enter frame, and on CLICK, I'd like them to reset to their original positions.Example:On frame 1 is an mc I created named holder. Inside there's an mc named box. Inside box are four mcs, circles1-4, inside the circles I have four skulls.I've also created an mc called rectangle and dragged it over the first skull to get the coordinates I want using the following trace:

trace(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
Resulting in these coordinates: 143.95,119.05,131.15,61
So, this works MOUSE_OVER the circles

[code].....

View 19 Replies

ActionScript 2.0 :: Assigning X And Y Coordinates To Array?

May 13, 2008

I'm pretty new to actionscript. I have an outline of a human body. When the user would click on one part of the body (x y coordinates) it would return the name of that part of the body? I'm assuming i would be using an array in this instance. How you can assign x and y coordinates to an array?

View 2 Replies

ActionScript 2.0 :: Assigning Movieclip To Dynamically Created Movieclip

Oct 24, 2006

In part of my actionscript i'm using: thumbnail_mc.createEmptyMovieClip("t"+k, thumbnail_mc.getNextHighestDepth()); to create a seperate movieclips for ewach image in my xml file. How would I then attach another movieclip to each of the newly created ones? ie thumbnail_mc.t0, thumbnail_mc.t1, thumbnail_mc.t2... is there a way to do it automaticall7y or do i have to assign it to each one individually? "thumbnail_mc.t"+k.attachMovie obviously doesn't work

View 11 Replies

ActionScript 3.0 :: Assigning Dynamic Variable Name?

Nov 15, 2011

I have a for loop - for (var i:int=0; i< results.length; i++)

and in this for loop a button is created - var multiplereportButton:Button = new Button();

I would like the integer value from i to be appended onto the name of the variable, so I thought this would work: var multiplereportButton + i:Button = new Button();

View 3 Replies

Actionscript 3 :: Assigning Dynamic Masks For Loop?

May 18, 2011

I'm loading 8 thumbnails via XML, placing in a sprite, and spacing them out with a helper grid class. This part works. What does not work is when I try to assign a mask to each of these (using a simpleRectangle class I made) I appear to only be assigning a mask to the last image. Am I doing something wrong with 'imageLoader.mask = _mask;' ?

My ultimate endeavor here is to click the thumbnail and animate the mask to reveal the entire thumb.I nested the showPictures function so it could have a reference to the masks, which is not optimal.

package
public class MiniGallery extends Sprite
{
//create($columns:int, $rows:int, $xSpacing:int, $ySpacing:int, $xPadding:int, $yPadding:int)

[code]...

View 1 Replies

ActionScript 2.0 :: Assigning Events To Dynamic MovieClips?

Mar 23, 2011

I load an XML file and through it create several Movie Clips. I want each movie clip to have a rollover and mouse click event, yet assigning the events does not seem to work at all. Here is how I create everything:

ActionScript Code:
var parsed_obj = new Object(); //This will hold the parsed xml data (once the XML loads and gets parsed).
XMLParser.load("xml/test3.xml", onFinish, parsed_obj);
function onFinish(success_boolean, anXML, xml) {
//This function gets called when the XML gets parsed.
if (success_boolean) {
LoadImages(anXML);
CreateAlphabeticalArray();
[Code] .....

When the XML successfully loads, we put it in a global variable and then create images based off the xml data. It might be a little verbose, but it gets the job done for now. I tried several methods creating objects to hold the events and attaching them, just using .onRollOver = function() { trace("whatever") };, etc. The code is on Frame 1 of the time line and not attached to anything. I experimented attaching it to a movie clip and doing onClipEvents, but that breaks the rest of my code because there are various sorting functions and button presses that don't get called.

View 2 Replies

ActionScript 2.0 :: Dynamic Button | Assigning Actions?

Jul 13, 2006

I have a script; what it does is is read a numeric variable (projects) from "text.txt" and dynamically attaches a relevant number of movie clips in a row. Each one of these movie clips serves as a simple two frame "button"; frame one is the unselected state, and frame two is the selected state...


// load external data

loadData = new LoadVars();
loadData.onLoad = function() {[code]....

anyway, this script works just fine, as is. the variable reads in perfectly, the movie clips attach etc. my problem is this: I want the button that I click to go to its active state. this is no problem as all I have to do is add an onRelease/gotoAndStop() command which is attributed to each button as it is created, as above. my problem is that, say I had a bunch of dynamically generated buttons, when I click one of these buttons I don't know how to tell the other buttons to revert to their inactive states i.e: return to their first frames.

View 2 Replies

ActionScript 2.0 :: Assigning Actions To Dynamic Movieclips

May 12, 2009

[code]When I run the file the image appears but isn't clickable.The full code is below.[code]

View 3 Replies

ActionScript 2.0 :: Validate Value Before Assigning To MovieClip TextField

Apr 15, 2010

I have a movieclip with a textfield with its variable property assigned to an external variable. I need a way of knowing when the value has changed to perform some actions, and also if possible to validate the value before it is assigned to the textfield. Is there a way to acomplish both this tasks in AS2?

View 7 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 2.0 :: MovieClip Animation Stops After Assigning Instance Name

Sep 22, 2009

I have an all flash website I am finishing. On the "index" page of it, there are 7 buttons all pointing to different painting galleries on another page (or another MC in this case).

These 7 buttons happen to be movieclips so that I can have animation on rollover and rollout. A sample of the current AS2 code for them is below:

on (rollOver) {
gotoAndPlay("s1");
}

[Code]....

In this case, on the index page there is a movieclip with successful animation on rollover/rollout. I assign this clip the instance name of "gallery0" and when clicked, goes to a separate page showing the first gallery.

My problem is this, whenever I do assigned the instance name to any of the 7 movieclips, the animation no longer works. It simply sits there in the default state and acts as it should as far as navigation goes.

View 6 Replies

ActionScript 3.0 :: Assigning Actions / Animations To MovieClip Buttons?

Mar 18, 2011

I am following along this tutorial: [URL]. And I get to the part where I need to add code to get my buttons to work, and I copy and paste the code and then change the frame labels to match mine, but then I get a syntax error:
"About_Project_mc, Layer 'hit area', Frame 1, Line 1
1086: Syntax error: expecting semicolon before leftbrace."

View 4 Replies

ActionScript 2.0 :: Assigning A Linkage ID To A Movieclip Created With CreateEmptyMovieClip()?

Jan 25, 2009

I have a movieclip I created usind createEmptyMovieClip(). How can I assign a Linkage Id to that clip?My reason for this is I later want to attach that clip I created to another clip using attachMovie() which requires a Linkage Id.

View 9 Replies

ActionScript 3.0 :: New MovieClip Variable - Assigning Value Of Event.Target

Feb 4, 2009

I am trying to define a new MovieClip variable and assign it the value of event.target in the function. I keep getting this error "1118: Implicit coercion of a value with static type Object to a possibly unrelated type flash.display:MovieClip."

import fl.transitions.Tween;
import fl.transitions.easing.*;
var p:Number = 0;
var scale_factor:Number = 0.4;
var tween_duration:Number = 0.6;
[Code] .....

View 9 Replies

ActionScript 2.0 :: MovieClip -ve Rotation-Height Is Not Assigning In Flash 8?

Nov 3, 2010

Here i ve create 2 movieClips outer,inner (outer.inner) .Am rotating outer movieClip to 90 degree. and am giving -ve rotation to inner movieclip.Then am loading images.jpg to inner movieclip ans setting width,height. Here height is not changed.ie .,value not taken to assign 4.If i trace am getting Wid:4 Hei:42.5

Code:
outer._rotation += 90;
outer.inner._rotation = -90;

[code].....

View 3 Replies

ActionScript 2.0 :: Assigning OnPress / OnRelease To MovieClip From Library

Mar 18, 2006

Lets say I have attached a movieclip from the library according to an array.length and I want to assign an onPress or onRelease on these movieclips attached lets say the length of the array was 4 .. so if I want to assign onRelease to this movieclips how do I do that?

View 8 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 :: Dynamic Coordinates For CopyPixels Rectangle

May 6, 2010

I believe this is esentially a math problem that may be easy for most of the programmers out there, but I am stuck. I have a fixed rectangle width = 50 height = 50 centered in the middle of the stage. I am using this rectangle to copyPixels of a bitmap that is also centered on the stage. The bitmap is draggable. I can define the initial x,y of the rectangle used for copyPixels with

[Code]...

View 1 Replies

Get X , Y Coordinates Of A Movieclip?

Feb 23, 2011

I have a movieclip inside another movieclip.[code]...

I can get mc_inside._x and mc_inside._y properties relative to the container movieclip, but how can I get the mc_inside._x and mc_inside._y relative to the _root (the stage)?

View 1 Replies

MovieClip Control With Buttons - X And Y Coordinates

Apr 8, 2009

I'm putting together a site, that has 3 pages and I'd like the content to move into position when the menu button is clicked. So, 3 buttons etc, 'Home, Portfolio, contact" and one movie clip that contains the info. I'm not really a programmer [URL].

View 1 Replies

ActionScript 3.0 :: XML Coordinates To Position Movieclip?

Nov 7, 2010

I have this XML that I want to use to set the position of movieclips placed dynamically on the stage but I am having a hard time figuring it out.This is what I have in my XML:

ActionScript Code:
<STARS>
<STAR XPOS ="93" YPOS = "44"> </STAR>

[code].....

View 6 Replies

ActionScript 2.0 :: Finding Movieclip Coordinates?

May 19, 2009

for some reason whenever i call or define a variable like this:

Code:
onClipEvent(enterFrame){trace(k); k = go._y;}
the trace results in "undefined". dose anyone know why and how to get around this issue? it

[code]....

View 1 Replies

ActionScript 3.0 :: Get The X And Y Coordinates Of An Object In A Movieclip?

May 16, 2011

Basically there's an object in a movieclip. I want to find the location of that object in relation to the movieclip, not of the object's symbol. So when i and look at the x and y of it, it wont show 0, it will show the x and y location in the movieclip it's in.

View 4 Replies

ActionScript 2.0 :: Trigger Movieclip Within Certain _x && _y Coordinates?

Apr 14, 2004

Is it possible? Has there been a thread on this..

View 5 Replies

ActionScript 3.0 :: Identifying MovieClip By Coordinates

Apr 11, 2012

I've been scouring the web to see how to do this, and now I'm not even sure it's possible. However, it seems there must be way. What I want to do is create a function that will take x,y coordinates and tell me what MovieClip or Sprite is at that location. I want it to happen automatically, without any MouseEvents or anything like that.

View 8 Replies

ActionScript 2.0 :: MovieClip Never Gets Sent To Proper Coordinates

Nov 29, 2004

I have a problem regarding the x, and y coordinates on a flash project of mine. Whenever I set the x and y coordinates for a movieClip:
Code:
function setPos() {
with (mc1) {
_x = 400;
_y = 300;
}}
The MovieClip never gets sent to the proper coordinates.

View 5 Replies

ActionScript 3.0 :: Way To Round All Movieclip Coordinates To Whole Numbers?

Oct 27, 2009

i have a bunch of movieclips inside a container movieclip.they all have really crazy coordinates, like x: 1590.24 and y: 696.66443i was wondering - is there an easy way to "quantize" them to round their coordinates to the closest integer?

View 2 Replies







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