ActionScript 1/2 :: Dynamic Layered MC Syntax For FOR Loop?
Sep 18, 2009
what I'm trying to do is access the data of several movies clips, that are inside of several other movie clips: MC1.insideMC._visible=false (which works, but isn't dynamic) but dynamically with a FOR loop. I've tried: For(bullet=1; bullet<5; bullet++){ "MC"+bullet.insideMC1._visible=false (this does not work) } Does anyone know the dot notation or another way to do this?
View 13 Replies
Similar Posts:
Dec 15, 2005
I've got a for loop and some fuctions working, but can't get one line of code to work. The red line below is what I'm having a hard time with. I'm calling a function called "moveit". If I insert moveit(x1, y1); then it works, and my movieclip is moved to the x and y positions that I specified for item #1. Though I want it to work for 10 items (I only have coordinates for two here, and will add the rest later).
I've searched my ActionScript book and just can't figure out what the syntax should be for calling that function.
[Code]...
View 14 Replies
Sep 15, 2009
I have an array like this:
Code:
var myData = new Array();
myData["name"] = "John";
myData["Age"] = 35;
What is the syntax to loop through and get the key and value? I have tried for each and for in but they just give me the value of "John" or "35", how can I get the key e.g. "Name" and "Age"?
View 2 Replies
Aug 11, 2011
I have put all button inside movieClip called "container" and I have added "container." inside for loop and now I am getting errors.
for (i=8; i<15; i++){
container.this["button" + btns[i].name.replace("btn","")].mouseEnabled = false;
}
View 7 Replies
Sep 7, 2006
I've got this loop and can't get it to work. It won't read the trace so I know the array call in my function statement is wrong but I can't see it at the moment. What am I doing wrong here? The rollover works when I write it out repetitively for the four buttons.
var btnAction:Array = new Array (oneBut, twoBut, threeBut, fourBut);
for (var i=0; i<btnAction.length; i++) {
this.menuMC.btnAction[i].onRollOver = this.menuMC.btnAction[i].onDragOver = function() {
[code].....
View 2 Replies
Aug 29, 2006
I've got this loop and can't get it to work. It won't read the trace so I know the array call in my function statement is wrong but I can't see it at the moment. What am I doing wrong here? The rollover works when I write it out repetitively for the four buttons.
var btnAction:Array = new Array (oneBut, twoBut, threeBut, fourBut);
for (var i=0; i<btnAction.length; i++) {
this.menuMC.btnAction[i].onRollOver = this.menuMC.btnAction[i].onDragOver = function() {
trace("anything");
}
};
View 1 Replies
Mar 25, 2007
Whats the correct syntax for declaring a variable within a loop? Something like this:[code]
View 1 Replies
Jun 30, 2009
I have a series of images loaded in via XML and assigned to "loady" movieclips. This code works fine:
Code:
_root.myMCL.loadClip(_root.myImages[0].attributes.url,_root.loady0);
_root.myMCL.loadClip(_root.myImages[1].attributes.url,_root.loady1);
_root.myMCL.loadClip(_root.myImages[2].attributes.url,_root.loady2);
_root.myMCL.loadClip(_root.myImages[3].attributes.url,_root.loady3);
[code]...
I want to replace this with a loop since I know the total amount of items (myImagesNo), but this isn't working:
Code:
for (i=0; i<_root.myImagesNo; i++) {
_root.myMCL.loadClip(_root.myImages[i].attributes.url,this["_root.loady" + i]);
}
View 2 Replies
Mar 12, 2010
I have a series of images loaded in via XML and assigned to "loady" movieclips. This code works fine:[code]
View 1 Replies
Nov 9, 2010
Can anyone tell me why the following is taking 4 seconds for Flash to execute:
_moleHoles = new Array();
var countingMoleHoles:Boolean = true;
var holeCount:int = 0;
[Code].....
There are 9 object on the stage (but this number could go up or down, that is why I'm dynamically grabbing these this way). So in my test case, this loop runs 10 times.
I have narrowed it down to something to do with the following line:
if (this['moleHole' + holeCount])
Is using dynamic (array syntax) object lookup that much of a performance hit?
View 2 Replies
Jan 14, 2011
This works fine
ActionScript Code:
mc1.onRollOver=function(){mc1._alpha=50}
mc2.onRollOver=function(){mc2._alpha=50}
[code]......
View 7 Replies
May 10, 2006
I'm using Flash 8, and creating a dynamic XML driven menu.I can't for the life of me figure out the syntax to make a 2 dimensional path to a movieclip.I can reference a movieclip dynamically with: _root["main"+i].label.text but how can I reference a movieclip like this:
_root.main1.subBut1_1.label.text
Where "main1" AND "subBut1_1" are dynamically written.I've tried _root["main"+i]["subBut"+i+"_"+t] and _root["main"+i]["subBut"+i+"_"+t], no dice.
Code:
function loadXML(loaded) {
if (loaded) {[code].....
View 5 Replies
Jan 6, 2010
I have some movie clips in the library I am loading but I can't figure out the right syntax to get the librabry item dynamicaly so I had to resort to a chain of "if" statements. I left off all the extra stuff like position and addChild etc just to make the code more clear.
for(var i:int=1; i>4; i++){
addChip(i)
} function addChip(id:number) {
if(id == 1){
this["chip"+i] = new twoXchip1()
} if(id == 2){
this["chip"+i] = new twoXchip2()
} if(id == 3){
this["chip"+i] = new twoXchip3()
}}
So what I want to do, is instead of having 3 "if" statements - to just use the "id" value I passed in to identify the right chip in the library to load. My real if chain is actually much longer than three and it's difficult to update ..I know there's a better way to do it...but every way I try throws errors!
View 5 Replies
Jan 12, 2012
How can I call the property of a dynamic child mc within a static parent mc? For example: a parent movie clip with instance name "parentMC" has four child movie clips with instance names "mc1", "mc2", "mc3", "mc4"
[Code]...
View 5 Replies
Jul 29, 2010
Having a hard time trying to resolve this issue, done a bit a of digging but can't find what i'm after. I'm pretty new to AS3 but know that Eval() has gone and been replaced with [] syntax. However, i'm trying to access a dynamic path to a clip and it seems that the array syntax will not allow more than one variable in a path.
[Code]...
View 2 Replies
Jul 14, 2011
using action script...
stop();btn001_btn.addEventListener(MouseEvent.CLICK,showimage1);function showimage1(event:MouseEvent):void { gotoAndPlay(10);}btn002_btn.addEventListener(MouseEvent.CLICK,showimage2);function showimage2(event:MouseEvent):void { gotoAndPlay(20);}
however movie is playing without stopping to "Listen" for a Mouse CLICK. Images placed at frame 10 and 20 should appear only when CLICK'd.
This code is straight out of Classroom in a Book CS4.
View 5 Replies
Nov 14, 2009
I am looking for the code or formula to created the video person talking over/in front of an html page created in DW full screen. I know how to shoot/create the FLV Flash movie file with transparent (alpha) background. The problem is trying to get the movie to float frameless over the html file without interference to the web page. Here is an example of what I am trying to do.... [URL] sorry this girl is taken. maybe there is a tutorial on how to do this somewhere. I have been looking for a solution for a few days.
View 2 Replies
Sep 22, 2010
I have two movie clips on the stage: mcA and mcB, each have a function when rolled over:
mcA.addEventListener(MouseEvent.ROLL_OVER , aActivated);function aActivated (event:MouseEvent):void{ trace('mcA was rolled over');}mcB.addEventListener(MouseEvent.ROLL_OVER , bActivated);function bActivated (event:MouseEvent):void{ trace('mcB was rolled over');}
Under certain circumstances mcA may overlap mcB. When the cursor rolls over their intersecting area I would like both functions to launch, how do I do that? Currently, the problem is that only the object on the top will launch its function.
View 2 Replies
Jan 28, 2009
I'd like a page with several buttons, each starting a different loop of sound (no more than a few seconds), so that you can end up with several loops playing at once. Is it possible to force any subsequent buttons pressed to wait until the existing loops reach their start before starting it's own loop? So that when a button is pressed it's loop will sync up with what is already playing?
View 1 Replies
Oct 18, 2009
So i have a movie clip inside another movie clip and i want to detect when my mouse is over the internal movie clip. I have tried attaching a mouse event listener to the internal mc but that didnt work.
View 6 Replies
Jul 20, 2009
How can I convert layered .fla or .swf files into movie clips (not sure which to use)? I'd like to be able to use 3 of them (at reduced sizes) in one larger file. Flash - CS3.
View 2 Replies
May 31, 2004
I have 5 movie clips on one scene layered on top of each other. One of them is the navigation which has 4 buttons. the other 4 layers are my content pages (MCs) which fade in and fade out along the timeline.
I want the buttoms to control the content pages.. when "option 1" is selected I would like the current page to start playing (where i have it fading out along its timeline) and the other page to come in!
I have no idea how to do this.... do you use IF commands?? if buttonpress etc
View 1 Replies
Feb 29, 2012
has the whole "roundtrip" feature been left out of Flash Professional CS5.5 when it comes to imported, layered PSD files? Is the only answered to crop down and save a single .png layer out of the orginial PSD file?
View 2 Replies
Feb 17, 2009
I have a project that was done in AS2, and instead of porting it to AS3(no budget..)I created an AS3 "shell" for all new features to be loaded into, and am communicating between the as2 and as3 with localConnection. This works fine, but the problem is since I want the new content to appear to be part of the old, I need to 'float' the as3 swf over/above the as2 swf. I can do this no problem using divs and css, but as soon as I do, the localConnection fails to connect in either swf. Both the swfs function fine in this configuration, but no localConnection
View 0 Replies
Apr 11, 2010
I'm trying to make a Image Gallery for my website by myself. However, although I can read ActionScript rather well, when it comes to writing it myself I tend to hit massive walls. Anyway I've looked at many tutorials and guides and all kinds of stuff but I still can't figure out how to get the coding to do what I want it to do. It isn't a bug because I can't get the foundations of the code down.
What I am envisioning is a initial main menu with several different selections (I.E. 3D models, 2D drawings, doodles, ect. ect. ect.) and when you click one it changes to that specific gallery. The way I thought to do it was using OOP to make a base GalleryEngine class and then implement it for the Main Menu and Image Galleries. I realize that I could do all this in flash but I think if I can get the framework of the code down that it will be easier to modify and switch out images and whatnot.
[Code].....
View 1 Replies
Nov 11, 2009
Basically I'm creating two (can be more or less) rows of layered MC treaten as Buttons.In each MC there is a small thumbnail hidden behind a coloured layer. When roll_over the coloured layer, this alpha goes to 0(zero) and entire MC resize +10% over x and y.On roll_out the opposite occurs, everything should get to the original alpha and size.The Problem: when moving the mouse really fast over the MC's and stop suddenly over one of them it starts 'blinking'
Code:
for(var i:uint =0; i<16; i++){
var miniPnt:MovieClip=new LittlePantone();
miniPnt.x=_xc;
miniPnt.y=_yc;
[code]....
View 2 Replies
Sep 2, 2011
[Code]....
I want to create "numeroEnemigos" Enemigo objects but flash give me this error "1084: Syntax error: expecting identifier before leftbracket." in the "var ["enemigo"+n] ..." line what is the problem?
View 7 Replies
Mar 17, 2010
I'm having a problem with importing a layered PSD file into Flash, an issue which i've read about in a number of forums but haven't yet been able to fix.
The content of the PSD file in question is numerous layers of line drawing which I am importing to the Stage and converting to keyframes in Flash. The layers have no white background and are clear but for the lines of drawing.
The problem I'm having is that the first layer of the PSD file imports perfectly, with its quality intact, but all those which follow it are distorted and jagged, and look pretty awful for some reason.
I have experimented with both lossy (set at 100) and lossless compressions to try and improve the layer quality, lossless is marginally better but not the best.
View 1 Replies
Oct 19, 2011
I just realized I was working on 4:3 when I need to make a 16:9 movie. So I resized the stage, but now everything is on the left side.
I tried turning on "edit multiple frames" and marked the entire stage, layers and frames and moved everything to the centre. Almost everything moved, excepted for material that is on motion tween key frames.
View 1 Replies
Feb 9, 2010
I'm making a game and I need to represent a "layered" circle in some clever datastructure.A circle can have any number of layers. Each layer has a number of "slices", they can be of different lengths and pieces can be missing. The innermost layer is always a full circle.Each segment has a color, multiple segments with the same color can be next to each other. Realistically a circle wont have more than about 40 layers or about 1500 individual slices.I will need to be able to easily find adjacent pieces to a specific piece, see if a piece is "hanging in free air" (imagine gravity towards the center), and to remove pieces leaving a hole in their place.
View 7 Replies