ActionScript 2.0 :: Assigning X / Y Positions To Dynamically Attached Clips

Jun 29, 2008

As you can see I am attempting to assign x,y positions to clips that are being "attached."
var clipArray = new Array();
clipArray = [189, 275, 361]; // x positions
for (var i:Number = 1; i < 4; i++) {
this.attachMovie("clip"+i,"butt_"+i,i,{_x: [clipArray(i-1)], _y: 142});
}

View 4 Replies


Similar Posts:


ActionScript 2.0 :: Dynamically Assigning MC Positions?

Jul 25, 2005

I have a navigation section built in Flash and am trying to position headers dynamically, based on variables passed from each page.

For example, the HTML on the HOME page, will have an swf with a variable like : nav.swf?dynHEAD=home

and NEWS will have a variable like : nav.swf?dynHEAD=news

then in flash, I guess something like this should work - but doesnt!

dynHEAD._x = 27;
dynHEAD._y = 211;

View 6 Replies

ActionScript 3.0 :: Flash - Assigning Frame Events To Dynamically Attached MCs?

Aug 12, 2011

I'd been working on a side-scrolling shooter game in AS2 for a while and it was going great, but for whatever reason, it scrolls all choppy and the framerate is inconsistent on faster machines. I would have expected the opposite, but it is what is is, I guess. So I'm trying to finally learn AS3, and I found some tutorials that got me started towards remaking what I had, but now I'm stuck.I'm trying to make one of those rotating cannons that shoots projectiles towards the mouse cursor. I have the rotation part working, but I'm having trouble with attaching the projectiles to the stage with enterFrame actions on them.I feel like I'm pretty close to a solution, but I don't understand where to put the functions to move the clips to make them work properly. In AS2, I just put something like this on the cannon clip:

Code:
bullet = _root.attachMovie("bullet", "bullet"+_root.bullets, _root.getNextHighestDepth(), {_x:nozzledot.pointx, _y:nozzledot.pointy});

[code].....

View 1 Replies

ActionScript 2.0 :: Targeting All Dynamically Attached Clips

Aug 21, 2006

I want to target ALL the 20 clips attached as below, at the same time, when I press the button "blue". However, my code can target only ONE of the clips at any time. I have tried attaching the clips to a separate dynamic clip and then targeting it but problems with the registration point (0,0) of that clip means I cannot achieve the result I want:

Code:
for(i=0;i<20;i++){
mc = this.attachMovie("red","red2"+i,i);
var scaleFactor:Number = Math.random() * 80 + 20;
mc._x = Math.random()*500;
mc._y = Math.random()*400;
mc._xscale = scaleFactor;
mc._yscale = scaleFactor;
blue.onRelease = function(){
new Tween(mc,"_xscale",Strong.easeOut,mc._xscale,200,3,true);
new Tween(mc,"_yscale",Strong.easeOut,mc._yscale,200,3,true);
}}

View 2 Replies

ActionScript 2.0 :: Use The Shared Object To Save The _x And _y Positions Of Several Attached MC's

Mar 4, 2004

I am trying to use the shared object to save the _x and _y positions of several attached MC's. The attached MC's have all been given a variable name and attached to a dynamically created MC called "world".I need to loop through all of the MC's in _root.world to save their postions to the shared object. Here is what I have tried,.... when I trace so.flush.. it traces to true but the object postions are not saved.......

Code:
_global.initSo = function() {
_global.so = SharedObject.getLocal("marinaSave");
// if the SharedObject object created a new shared object

[code]....

Am I using the for... in method correctly to loop through the MC's in _root.world and save their values?

View 4 Replies

ActionScript 2.0 :: LoadMovie When Clips Are In Specific Positions

Feb 18, 2005

I have a sliding menu, and need to loadMovies when specific clips are in specific positions.
For gallery, for example, the code I'm using is:
if (xTargetSLI = 350){
loadMovie ("gallery.swf", 1);
}
But with that code, gallery.swf loads by itself, regardless of the position of SLI.

View 7 Replies

ActionScript 3.0 :: Accessing Clips Inside Clips Of Dynamically Generated Clips

Jan 15, 2009

For loop generates clips containing clips. I need to access a specific clip (look_back) within the parent clip generated by the loop. Not sure how to do this.[code]

View 1 Replies

ActionScript 3.0 :: Load Movie Clips Into Random Positions?

Mar 24, 2010

I have three movie clips on my stage. Their names in my library are a1_mc, a1_mc2, and a1_mc3. Each of those movie clips on my stage has a different instance name. All of these are connected with an actionscript in the same file.Now, I'd like the movie clips to appear at a random position every time, they are loaded.

I already tried to make a new array and solve this issue with the sort() command. However, that did not work out properly. The positions and instance names of the movie clips on my stage are as follows:

a1_mc
instance name on stage: a1
position on stage: X = 20.0 | Y = 140.0

[code]....

View 1 Replies

ActionScript 2.0 :: HitTest And Changing Scales And X-y Positions Of Parent Clips?

Sep 29, 2005

I'm just wondering if hitTest can be affected by the changing x,y coordinates or the changing scale of the parent clips. My platform engine doesn't seem to work everytime I try to add a script to a parenting clip (of a playable character and a computer character) that changes the x and y values of that clip as well as the scale (simulating a camera that keeps both characters in focus).

View 2 Replies

ActionScript 2.0 :: Flash8 - Attaching Movie Clips To Already Attached Movie Clips?

Jun 5, 2011

As most of you don't know, I've been creating an rpg game. And, after several tries of art making, etc, I have finally moved back into coding the game. And now, I'm stuck on the equipment system idea. At first, I thought I would just place a bunch of goToAndStop's for each movie clip to go to a frame that has that certain armor piece. This was my first idea for an equipment system. However, after doing some research, and realizing how much lines of code could be saved, I started looking into simply adding and removing movie clips from the character as my new equipment system idea. Now.... on to the problem.

Basic want/ overall achievement wanted: Create an equipment system, which will basically attach movie clips (items) onto characters, which themselves will already be attached movie clips on the stage.

Problem: What is the exact code to do this? And Is there a better way to do this for an equipment system (a less laggy or more efficient way perhaps that I'm not seeing; Check the code below to get a better idea of what I'm talking about)?

Part of the code (or basic idea of code; see comments for extra details

code:
//Don't worry I have an OnEnterFrame function here;
//attachedObj= the character; figure= the MC name of the character;
attachedObj = attachMovie("figure", "figure"+1, 1);

[Code].....

View 2 Replies

ActionScript 2.0 :: Assigning Same Property To Multiple Clips?

Apr 9, 2008

Is there a simple shorthand for assigning the same value to multiple movieclips? For example, I have 25 MCs with names "img1", "img2" etc. and I want their _alpha value to be zero.

Is there a for loop or something I can use so I don't have to type "img1._alpha = 0;" "img2._alpha = 0; etc.

View 3 Replies

ActionScript 3.0 :: Assigning Names To Movie Clips In Loop?

Mar 21, 2009

im trying to run a loop and assign all my new movie clipswith different names. i have tried .name and ._name they dont seemto be working..

for (var i = 1; i<=5; i++) {
imageName = new ImageMovie();
this.addChild(imageName);

[code].....

View 1 Replies

ActionScript 3.0 :: Looping Movie Clips And Assigning Events?

Apr 7, 2009

In AS2 I could assign events for a ton of movieclips like this:

Code:
for (var i in mcMap) {
if (typeof (mcMap[i]) == "movieclip") {
mcMap[i].onRelease = function() {

[Code]....

View 2 Replies

ActionScript 2.0 :: Can't Get The Clips To Be Attached To The Right Side

Jul 20, 2006

I was making a small animation maybe for forums and stuff just wanted to see if i cud do it when i had some problems. What i want to happen (don't ask why) is to have these random movie clips from the library to come on stage from the far right side and to move over to the left and be deleted, but have the movie clips being moved, deleted, and loaded continuously. The problems i'm having are that i can't get the clips to be attached to the right side because the depth is all different. here's the code on the first frame. I will attach the .fla file too.

Code:
onEnterFrame = function() {
//random number generator
rand = Math.random()*20;

[Code].....

View 4 Replies

ActionScript 2.0 :: Move Attached Movie Clips?

Oct 27, 2008

I am trying to move attached movie clips, but I've come across a problem. This is the code inside the movie clip that's attached:

ActionScript Code:
function moveFrom(which){
for (i=which;i<20;i++){

[code]....

View 9 Replies

ActionScript 2.0 :: Targeting Attached Movie Clips

Dec 13, 2005

I'm having trouble figuring out how to target a series of movie clips i'm attaching to my movie.I'm loading some xml for a slideshow and i'm generating a series of dots at the bottom of the screen to indicate how many steps are in the slideshow and the circle is meant to highlight your current position as you step through the presentation.the MC for the dots is two keyframes with a different color and a stop action on each frame.
Here's the rundown of the code:

1. There's nothing weird here, i'm just bringing the xml in [code]

2. Here is the loadXML function i reference in the xml.Data.onLoad above:[code]Okay so now i have some dots with the instance names, step0, step1 etc. right? And at the end of my loadXML function you see the firstImage(); function. This is where my problem is, how do i target the first (step0) instance? I have no problem when I write "step0.gotoAndStop(2);" but I need to figure out how to use a variable to keep moving it along when i make my next and last functions for the slideshow.

3. Here is the firstImage function:[code]how do i target the step the same way i target the image? do i have to go back and do something in the loadXML for loop?[code]

View 2 Replies

ActionScript 2.0 :: Attached Clip In Between Depths Of Other Clips

Mar 8, 2006

I have ablut 60 movie clips attached dynamically on the stage in flash each at various depths. I want to place some other movie clips in between the depths of those clips dynamically .. how would i go about that?

View 2 Replies

ActionScript 2.0 :: Nesting Attached Movie Clips?

Nov 13, 2006

is there a cleaner way to attach movie clips than this type of syntax?

_root.attachMovie ("Frame", "frame", 60);
frame._x = 375;
frame._y = 375;

[code].....

View 2 Replies

ActionScript 2.0 :: OnRollOut Not Working On All Attached Clips

May 21, 2007

i'm trying to make this little news section and for some reason the rollover and rollout works only on the last news itemClip to be attached. you can take a look at it HERE and see that the bottom one is the only one working.[code]

View 3 Replies

ActionScript 2.0 :: Position Movieclip On Top Attached Movie Clips?

Nov 27, 2009

I would like to have one movieclip over the top of other attached ones. I have tried getNextHighestDepth on the movieclip, but it still doesn't work. Here is my code for attaching the movieclips:

PHP Code:
function growSpider() {
spiders = 0;

[code].....

View 1 Replies

ActionScript 1/2 :: Drag And Drop With Attached Movie Clips?

Nov 16, 2009

I have a button that has an onPress function that attaches a movieclip with startDrag(true) so the attached movie snaps to the mouse and can be dragged around. The problem is that I don't know how to set up the onRelease function so that when the mouse button is lifted the attached movieclip is removed. Also, the attached movie appears in the upper left corner for just an instant before snapping to the mouse.

View 9 Replies

ActionScript 2.0 :: Dynamically Assigning Hyperlinks To Buttons

Jul 22, 2005

I have some basic knowledge in PHP and am learning XML, and basically have decided to prepare my site for the future by switching to strict XHTML / php (plus it needs to be updated anyway). It is a hybrid site with HTML and Flash elements, and each HTML (soon to be .php) page has a single .swf as the nav bar. Is there a way to externally assign hyperlinks to the nav buttons within this .swf? I've done basic external assigns (with .txt files into dynamic text boxes), but this seems a bit trickier. Basically, I want to be able to update the .swf without opening flash, changing the links, and then publishing a new .swf.

View 6 Replies

ActionScript 2.0 :: Dynamically Assigning Variable Names?

Mar 29, 2007

dynamically assign variable names from XML? For instance, if I have an XML file with a list of variable names and their respective values, can I make my Flash movie create these variables?

View 5 Replies

ActionScript 2.0 :: Dynamically Assigning An Event Handler?

May 16, 2005

I'm creating a photo gallery script with 3 categories (people, places, and things). The 3 categories all share the same thumbnail movie clips whose onRelease handlers I want to change depending on whichategory is selected If you look at the newCat() function at the bottom of the script you'll see my comments as to what is happening and when Apparently the event handlers being assigned to the thumbnails are using the local variable 'pict' inside the 'newCat()'function which is being overwritten each time the function goes through a loop? Does anyone know why this is happening or another approach I can take?

Code:
//set up picture categories and file names
people = ['mittens.jpg', 'penny.jpg', 'selfportrait.jpg'];

[code]....

View 2 Replies

ActionScript 2.0 :: .onEnterFrame And HitTest Now Apply To The Clips Attached To The Original Clip?

Jan 5, 2010

say I have a clip with an onEnterFrame running on it with a hit test to check if the user has rolled off the clip . . . Then i create an empty clip within that clip and attach clips to it. Will my .onEnterFrame and hitTest now apply to the clips i have attached to the original clip?

View 2 Replies

Actionscript 3 :: Dynamically Creating And Assigning Names To Movieclips?

Oct 28, 2011

I have a movieclip that I need to duplicate dynamically based on an outside variable.e.g. clip1, clip2, etc This variable changes so I can't hardcode the number of times it occurs.Is there a way to dynamically create this movieclip multiple times and align it according on the screen?

View 3 Replies

ActionScript 3.0 :: Dynamically Assigning Instance Names To TextField

Mar 31, 2011

Is it possible to add a textField dynamically but have different instance name each time this is created? In other words if I have a button that whenever its click it will add a textField to the stage and assigns a new instance each time this is added.

ActionScript Code:
button.addEventListener(MouseEvent.CLICK, addField);
var inputWidth = 200;
var inputHeight = 20;
function addField(event:MouseEvent):void{
[Code] .....

Something like this but instead of textFieldName this would be different each time.

View 8 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 2.0 :: Why Emptymovieclip Positions Affect Positions Of Thumbnails

Jan 22, 2007

I have thumbs placed on the stage. I create an empty mc to load swf. But my thumbs disappear from the stage when I test the movie ( html or swf) if I settle the _ and _y position of the empty mc.why the emptymovieclip positions affect the positions of my thumbnails?

View 2 Replies

Actionscript :: Flex Assigning Events To Dynamically Created Buttons?

Jul 18, 2011

My app has buttons that users press to insert predefined strings into a textarea. I'm now making it load in the button values dynamically so users can define their own buttons.I'm using a buttons.txt which contains a different label on each line (button1, button2,button3 etc). I loop through the text file and add the buttons to a group. This all works, but now the hard part. How can I assign an eventlistener to these buttons so that they output text to the screen?

protected function view1_viewActivateHandler(event:ViewNavigatorEvent):void
{
var path:File = File.documentsDirectory.resolvePath("buttons.txt");

[code]......

View 1 Replies







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