how do I reference a button that has been loaded dynamically?Furthermore, is it possible to use the removeMovieClip() method with a button that is inside the movieClip you are trying to remove?Simply put, I've got a movieclip that is loaded via the "attachMovie" method. There is a button inside that says "Close". I am trying to use the removeMovieClip() method on that button, but it's not working. I can put a button on the stage, and use the same method, but it doesn't work.
First of all: this is my first post at actionscript.org *happysound*. I'm working on this flash gallery since a couple of days and something is drinving me crazy in actionscript.
The concept: in this part of the flashfile i'm loading thumbnails in dynamicly created movieclips on stage (1.jpg, 2.jpg, 3.jpg). Everything is working fine, but now I wanted to add some fancy fading when the loading of a single thumb completes. For some reason I can not get the tweening class working and I'm sure it's a problem with the referencing to the clip. I know this cause when I change "thumb"+i to thumb1 it is working. Googled for hours without result..
I know that a dynamic mc can be referenced using array notation viz: myArray['someName'+i] My question is ... can mcs that have been placed on the stage and given instance names be referenced in some similar way? If I have placed 10 mc's with different instance names eg mg1, mg2, mg3 etc, can I reference them using array referencing?
I'd like to add a couple of different MC's to the particle stream. I'd like to do that by referencing different items in the library.So I have 12 different particles in the library exported with classes named from Bubble0 to Bubble10 now as I run through my for loop I'd like it to use a different particle each time. first time I tried:
ActionScript Code: var bubbleArray:Array = new Array(); bubbleArray.push(Bubble0,Bubble1,Bubble2,Bubble3,Bubble4,Bubble5,Bubble6,Bubble7,Bubble8,Bubble9,Bubble10,Bubble11) for (var j:uint = 0; j < NUMBER_OF_BUBBLES; j++) {
[code]...
Scene 1, Layer 'actions', Frame 1, Line 871086: Syntax error: expecting semicolon before leftbracket.Is what I'm trying to do possible without some clunky switch statement?
P.S. I tried searching the forum for an answer but the terms are so common I couldn't find what I'm looking for.
I am trying to reference a movieclip within a movieclip that I am loading using "attachmovie". In the first frame of the root, I am attaching the movie. Then, from the attached movie I am calling a function that is also in the first frame of the root. In the function I am tring to set the property of a clip within the attached movie to visible using the following code:
_root.logIn.loginMessage._visible = true;
I have also tried _root["logIn"].loginMessage._visible = true; with no luck.
(logIn is the name of the clip I am attaching using attachMovie and loginMessage is the clip I am trying to reference in the attached movie)
This is how I'm loading it and I know that part is working: _root.attachMovie("login_mc","logIn",getNextHighes tDepth());
I'm making a flash game in which I need to spawn movieclips and I am attempting to use dynamic referencing to cut down on the number of lines I need to write.
The following code is my attempt to fade out current clip then to fade in selected clip via one onRelease command. Here's the code. Can someone set me straight?
Code: import gs.TweenLite; import gs.easing.*; var whoIsOn:Number = 0; var clip:Array = ["orange","cranberry","melon","mango"];
how do I reference a dynamic text field in my fla file from a class which isn't the document class? For example: I have an fla file called main.fla which contains no actionscript and has a single dynamic textfield called "text_txt" on the main timeline.
i'm looping thru xml nodes and using this to attach clips to an empty mc:Code:item = _root.mainHolder.links.linkHolder.attachMovie("linkClip", "linkClip" + i, i);my question is how can I reference the previously attached clip so I can determine the _y property of the current item(clip).I'd like to do something like this.item._y= previously attached clip._y-previously attached clip.height
I am adding a bunch of MC's(linkage ID:buttonHolder) dynamically using a for loop and attachMovie. If I want to dynamically add an onRelease function to each of those MCs,so that each of them links to different links how would I accomplish that? here's where i've reached so far..
var depth:Number=0; var nextY:Number=77; for (i=0; i<5; i++)
I'm making a function, and I want to pass it's handling less restrictively, kinda like jQuery I guess.
Code: function cfunc(min, max) { return (Math.floor(Math.random()*(max-min))+min);
[Code]....
Now I know that alternately, I could pass them individually to the function and then join them all together as one, but I'd prefer to use one variable and pass the data through it, kinda like a scripting engine.
I posted this a few days ago and am still stuck. I have read a myriad of tutorials on arrays, and still cannot fathom out where I am going wrong. I have commented the code. The story is as follows: I want to be able to create a dynamic list. In the library I have exported for .as a movie clip given the name "nav"
If I have movieclip named box01_mc inside movieclip btn01_mc and I wanted to change box01_mc's alpha to 0 on the rollover of btn01_mc how would I write this? I tried writing the following code on btn01_mc but it didn't work:[code]
I'm doing this object oriented game and I create a bunch of 'boxes' via a for loop
Code: Select allfor (var z=0; z < numOfBoxes; z++){ var box:Object = new Object(); box.mc = new Box(); box.mc.name = "box"+z box.mc.x = Math.round((Math.random()*(530-box.mc.width)) + 20); for (var i=0; i<boxXArray.length; i++){ [Code] .....
I get my random amount of boxes scattered over my stage (I haven't put in any checks to see if they are touching). How do I 'name' these boxes so I can reference them later? Say I want to move the .x of boxA in another function? Is there a simple way to call them box+z instead of just all as box? (Then I can run them through a loop later to talk to them).
I'm using duplicateMovieClip to create instances of a clip. Then I use an array to name the clips. In the scrip that duplicates and names them, I also have an onRelease function to make the mcs do something when you click them. I can't get this onRelease part to work.
I need to: - swap the depths - load some text - attach a movie from the library
I can't see any errors with my script, so I hope someone can look at it and give me a clue. The part I'm having trouble with is:
I'm having issues trying to reference a movieClip after attaching it. What I have is: Code: btn_instructions.onRelease = function() { instructions = true; attachMovie("parchment", "mc_parchment", getNextHighestDepth(), { _x:280, _y:280 }); } mc_parchment.btn_close.onRelease = function() { instructions = false; trace("close"); removeMovieClip(mc_parchment); }
The first is creating it on top of the other items that are created during the game. I can't have the instructions on the timeline and just change the visibility of it due to all the assets this game is making. The instructions variable is used in an if statement elsewhere in the game to lock the user controls so they can't create anything else in the game while your viewing the instructions. The second function is the one that should close it. The movie clip that's attached has a button in it, with the instance name btn_close. The trace doesn't even pop up so it's not targeting it correctly. Yet when I go to 'debug' and 'list objects' both mc_parchment and mc_parchment.btn_close are listed as being in the scene after clicking the instructions button.
var xBoard:Number = Math.floor(mouseX/cellSize); var yBoard:Number = Math.floor(mouseY/cellSize); if (board[(yBoard-1)][xBoard] == 0) { root.getChildByName("b"+(yBoard-1)+xBoard).alpha = .7; }
I want to be able to call various movieclips I have arranged in a grid from these two variables (xBoard and yBoard). They get new values every time I click on my gameboard.
Basically I check if they space ahead of the unit is empty. If it is I want the alpha of that space to change designating you can move there. The movieclips are arranged in a grid and named b00 (top left) to b77(bottom right).
This is the error message:
1061: Call to a possibly undefined method getChildByName through a reference with static type flash.displayisplayObject.
If I take out the getChildByName... root.("b"+(yBoard-1)+xBoard).alpha = .7; This is the error message:
TypeError: Error #1123: Filter operator not supported on type Game_fla.MainTimeline. at Game_fla::MainTimeline/test()
I am calling an image from a server to be displayed in flash using php, mySQL. If the image is in part of a browsing gallery where there are eight images on screen all in movieclips how do I get it so when a movieclip is clicked it recognises what image it contains and then goes to another frame where it can have just that one image?
I was creating a drap and drop simple game, dragging and dropping an item from within a movie clip. All was working fine, but then I had to add more items so I created a ScrollPane and referenced the movie clip through that, now I need to rework how I pull reference that movieclip again. The movieclip is exported so the scrollpane can bring it in...
package { import flash.display.*; import flash.geom.Point; import flash.events.*; public class shopping extends Sprite { public function shopping() { shoppinglist.Ketch.addEventListener(MouseEvent.MOUSE_DOWN, pickUp); shoppinglist.Ketch.addEventListener(MouseEvent.MOUSE_UP, dropIt); [Code] .....
Basically I'm trying to get a certain section to open when it's corresponding button is pushed The button has an instance name of "home" The section I need to be able to reference is labeled "home_mc"
[Code]...
My gut tells me the code should work, but every time it runs through, I get "Actionscript Error:#1065: Variable home_mc is not defined."
Trying to convert a project from as2 to as3. Take this simple function: Code: function add_tf(contents:String,target_clr:uint,font_size:Number,a_type:Number,a_thickness:Number,a_sharpness:Number,target_width:Number, target_height:Number) { var format:TextFormat=new TextFormat ; var tf:TextField=new TextField ; [Code] ..... How do I reference the newly created textfield into a for loop?
i was wondering how i would access the desired movieclip's x, and y value from it's function.[code]HOW do i access the x and y values of MC from here like you would use "this._x" in AS2, how would i do that here?
I'm trying to set something up that will print a bunch of boxes on a grid in a certain pattern, and set things up so that a path can be determined from the start to the end. Each grid square is a MovieClip with an instance name x0y0, x1y0, etc. for each coordinate of the grid. I want to set a variable in my grid square class to 1 or 0, depending on whether or not a box is in that square. So I have this code:
Suppose you have a movie clip called MC1 and it is on frame 20 of the stage in layer 3. How should I refer to this MC within actionscript? Can I only refer to this movie clip from frame 20?