Long time listener, first time caller here. I'm having trouble with how Flash sets the _x property of a dynamically created movieclip. If I create a rectangle on the stage using the Drawing API:
Code: //for the purposes of this example, assign a value to i var i:Number = 0; //assign var squareName var squareName:String = "square" + i; //create an empty movieclip named [squareName] at depth 1 this.createEmptyMovieClip([squareName], 1); [Code] .....
I'm not new to Flash by any stretch of the imagination, but I have never come up against this problem before. For context, I'm actually getting my feet wet with the Tween class, and am having trouble animating dynamically created movieclips due to this confusion with coordinates. When I tween a dynamically created clip from one set of coordinates to another, they are offset by the movieclip's _x and _y properties starting at 0, 0, rather than their actual position on stage.
Im dynamically creating an instance of a movieclip, call it a game piece. This game piece has 4 frames, each with a movieclip called base(although one is red, one blue, one green, one yellow). When the game piece is created I set the frame to indicate player color. Im also changing the alpha of base to 1.0 when its being dragged, 0.5 when its dropped.
Using the following code, everything works fine if the game piece color is set to the base in frame 1 (red). If the game piece is created and the timeline moved to a frame other than 1, I throw an error when trying to access base.alpha (this would be the second, third, and fourth instances of base in the game piece timeline). Heres the strange part, this is only a problem when the game piece is first created and added to the display list. Once created, even after the error has been thrown, I can access the alpha of bases 2, 3, and 4 in the drag start/stop listeners. Heres a link to the work in progress, and the relevant sections of code (shortened for brevity, t1 is the top left piece on the pallet, others just repeat the same code):[URL]
i'm creating a completely dynamic form. i want to assign a variable name to a textfield and then pass that variable with a LoadVars() object.
here's a small piece of code i can't get working:
//create movieclip (used like a form) _root.createEmptyMovieClip( 'dialog_body', 0 ); //create textfield input
[Code].....
bottomline: if i create a textfield using the traditional method and assign the 'var' it works fine. if i create a textfield dynamically at run time, and use the *.variable property, the variable is NOT sent..
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
I am having problems while creating object with actionscript, I am new to it and I am getting some errors. I am creating my object this way
Code: var myMC:MovieClip = new MovieClip(); myMC.x = 50; myMC.y = 50; myMC.name = "hunterToken"; tCursos.addChild(myMC); And it is created, so far everything's good
Later I try to access the visible property, and I get an error Code: tCursos.hunterToken.visible=false; And I get this error: Code: TypeError: Error #1010: A term is undefined and has no properties. at newSiteHTR_fla::mCursos1_1/go()[newSiteHTR_fla.mCursos1_1::frame1:157]
I have a class which crate a panel with close button. and i create an instance of this class like this
function _smallThumbClick(evt:MouseEvent):void { var _popup:Popup=new Popup( square.width ,evt.currentTarget.y, evt.currentTarget); addChild(_popup); }
and this mouse event from the thumbnail(suppose), so if i click on the thumb it will create popup. so i want to close all other or previously opened pop window.
How do u get the popup class object to close from another class..
or is there any alternate method for detect instance of the movieclip or class..
How do I put a rollover on a dynamically created movieclip?
I have several movieclips being placed inside a container movieclip and I need them to have onRollOver, onRollOut and onRelease events. The way I usually target and do this...
...does not seem to work for whatever reason. However, if I put a named instance of the movieclip on the stage myself and target it in exactly the same way (with similar syntax), the rollover works fine.
I'm trying to build a Flash-based controller application to go on the web interface for the rack-mounted units which my current employer builds. The interface is defined in an XML file which is parsed and processed when the Flash application is started.
I've created some library symbols which act as various controls - sliders, toggle buttons, etc. I can add these fine to the stage. What I would like to do is group them together in a container of some sort so that I can show and hide them en masse without having to loop through all the controls. All library symbols I'm using are linked to ActionScript classes.
If I use a symbol I created earlier and added to the library as this container, everything works fine and the controls display correctly on the stage.
However, if I dynamically create a MovieClip and use that as the container, it never appears on the stage. The code is identical in both cases except for the class names being used. I am calling addChild() on the MovieClip instance to add the controls to the MovieClip, and then call addChild on the document class to add the MovieClip to the stage. As I mentioned above, this all works perfectly if I use a pre-created symbol from the library as the container.[code]...
There are multiple MovieClips that will be dynamically placed on stage. These MovieClips are coded to be buttons. I'm trying to figure out--when a user clicks on the MovieClip...figure out which object on the flash stage the user clicked on.Inside function toggleClick I put the trace statement: trace("movieClip Instance Name = " + e.target.name);
In the OUTPUT window: movieClip Instance Name = instance5 movieClip Instance Name = instance12
How do I access the methods of a dynamically created movieclip/object?
For simplicity sake I didn't post code on how I dynamically created the movieclip. Instead, assume its already created. It is an object. It is called field_2. Below it is referenced by using getChildByName('field_' + field.id);
Check_box_component.as
public var testVar:String = 'test'; public function testReturn() { return 'value returned';
[Code]...
When I trace temp.testReturn, why does it show "function Function() {}" instead of "value returned"?
I'm trying to create a movieclip and load a "frame" image inside of it, then create another movieclip inside of the first, and then load another picture inside of the second. Something like this:
var thumbFrame; var thumbPicture; thumbFrame = container_mc.createEmptyMovieClip(thumbFrameName, 1);[code]..........
But it doesn't seem to work the way I want: the "thumbPicture" doesn't appear on top of the "thumbFrame" as I expected... only the "thumbFrame" shows (with it's image succesfully loaded). Am I missing something?
EDIT: If I comment this: //thumbFrame.loadMovie("thumbFrame.png");
The thumbPicture.jpg shows inside of the first movieclip, so maybe the issue is with the .loadMovie?
Is there a way to obtain a reference name of each item on the stage. A reference name that can be then used to manipulate the object? (and how would one do that if successful in obtaining the name?)
As an example that is not working for me, if I drag to stage two movie clips and dynamically include 5 additional movie clips at runtime, this [code]...
Any examples on creating the horizontal scrolling menu with dynamically attached clips? the style where if the user mouses over the right hand side of the menu it slides left, etc? There's lots of tutes out there for simple scrolling but not much that take a dynamically sized clip into consideration!
[code]Then in another function, where I handle a rollover events for the Main Menu, where I want to remove the movieclip "target_mc" after a certain rollOut event [code]doesn't work.Now, I realise this is probably cause it's not in scope, but how would I remove a movieclip that is dynamically created in another function?
As u must have noticed, the movieclip i wanna draw, namely _root.VESSEL, itself contains several other clips (eg _root.VESSEL.db). The problem is that the clip doesnt get drawn at all! All i get is a white rectangle of the size i've created the bitmapData. But nothing of that movie clip has been captured.
is it that the BitmapData cannot capture the details of a clip if it has child clips?? Coz here, VESSEL itself was created empty, and all the new shapes are actually being placed as movie clips inside other empty clips that were created in VESSEL.
I am trying to create a navigation element. The items in the navigation are created dynamically from data in an XML file. What I would like to do is create a new movie clip then place all of the navigation elements into that movie clip so I can move it around as one piece.
Here is a simplified example of my code:
Code: var navContainer:MovieClip = new MovieClip(); //clip to add elements to addChild(navContainer); //Create nav elements that I want inside navContainer//
I'm dynamically adding to the stage a series of mc from a MovieClip class contained in the library(instance.name: "btn_1", btn_2", etc..) and trying to call them from a method within my Main.as class. What's the best way to do this. I can't seem to reach these dynamically created MCs.
every so often a movieclip is dynamically created using actionscript from the main timeline. It has the instance name of
Code: ["spark" + i]
each time one is created "i" goes up 1. so I end up with spark1, spark2, spark3, spark4 etc. etc.What they need to do is play through an animation (about 4 frames) and then destroy themselves.
I created a movie clip symbol with a user interface in it, using the standard components. It contains various components that I draged on the stage. I named the instances (e.g titleLabel). Then I created an ActionScript class for that user interface. Under the linkage properties of the symbol I specified that class. In the class itself, i declared the attribute "var titleLabel:Label". I thought this would be the same instance from the symbol? But: Trying to set the text of the Label AFTER the movie was dynamically added to the parent does not work. I cannot access any properties.
Here is the example:
My Class for the user interface:
Code: import mx.controls.*; class Information extends MovieClip { var titleLabel:Label; //this is the same instance name as in the symbol
I'm having trouble to center any dynamic content (movieclips, textfields...) inside a dynamically created movieclip, which has a default point of interested in the top left corner.
PS: Just as an example, I have a dynamically created text field inside a dynamically created movieclip....and when I try to scale that movieclip I need to scale it from its center
I am trying to load an image in to a dynamically created movieclip, which is:
_root.mySlider."+stripX2(band[i][0])+i
but I can't seem to reference it. I can load the movie into _root.mySlider, but if I add the dynamic element (stripX2(band[i][0])+i) without quotes it it doesn't load. If I load with quotes i.e.
"_root.mySlider."+stripX2(band[i][0])+i
flash doesn't allow strings in movieClip variables.The code I'm using is belowm, it's the second to last line thats causing the problem:
var loadListener:Object = new Object(); loadListener.onLoadComplete = function(target_mc:MovieClip):Void { trace(">> target_mc._width: "+target_mc._width);[code]......
I'm dynamically creating movieclips with dynamically created movieclips inside them and am having trouble with targeting them.Below is a simplified example of what I'm trying to achieve, in the real file there are a lot more movieclips and I'm creating and naming them with a for loop.
This one is just one Sprite created inside another sprite. I can target the top level sprite named "testname". However when i try target the nested MC it throws an error.The bottom couple of traces are just test MCs I've made to make sure i got the syntax right, on targeting nested movieclips.
PHP Code:
var holder:Sprite = new test1();holder.name = "testname";this.addChild(holder);var holder2:Sprite = new test2();holder2.name = "testname2";holder.addChild(holder2);trace(getChildByName("testname").x); //this one traces finetrace(getChildByName("testname").getChildByName("testname2").x);//this throws up an errortrace(testclip1.x);trace(testclip1.testclip2.x);
a movie clip symbol is designed and subclassed in Flash, but get instanced and addChild-ed in AS3. It works well as long as I don't change it's width/height property (scaling works too), but if i do, it disappears
Essentially, I've got a MC container that's created dynamically based off an XML file (basically for every <title></title> I've got, it makes a new "card"). Now within the context of each <title></title> grouping I've got <imgs></imgs> in which I specify the path to images that are related.All of that works perfectly, save for the external jpg files actually appearing on the stage. The MC I add them to does, but the external image doesn't.My problem is- I can't add the external images until they're completely loaded (or so it appears). The thumbnail BG I use is blank. So I know for a fact that the thumbnail BG isn't occluding the loaded thumbnails.