ActionScript 2.0 :: Control Instance Name Dynamically?
Jul 19, 2009
I have 100 buttons, named k1 till k100.I don't want any code inside the button.I need to make the buttons invisible when pressed.I get a currentframe back from something else (example 22) and at that moment I want k22 to be invisible (k22._visible = 0)
I tried:
aa = k;
bb = 22;
cc = k+22;
cc._visible = 0;
also tried as string "k" "22" but it doesn't work
cc = k22;
cc._visible = 0;
works but I need to make it work from kk+22;
View 3 Replies
Similar Posts:
Nov 17, 2009
[code]...
which controls a component instance, i want to use this code in a button on another swf file, how can i do this?, is posible to use a statement, i do not understand the concept of target path yet.
View 6 Replies
Jul 13, 2011
i have lots of movieclips in different frames and i must control them to go frame 2. i can't use
Code:
movieclipname.gotoAndStop(2);
because they don't have instance name and there are over 1000 movieclips.what would be best way to do that
View 1 Replies
Apr 14, 2011
I am using this function to create a textfield, but i can't control it i like to hide it when a cubes rotation is completed[code]...
View 2 Replies
Nov 4, 2011
Say i have a movieclip named a_Mc ( ClassA ) I have a sub-movieclip named b_Mc ( ClassB )
CASE 1: Accessing the sub-movieclip b_Mc which is already present inside the a_Mc movieclip
( Since Flash IDE has "Automatic instance naming" OFF )
ClassA mentions the name of b_Mc as => var b_Mc:MovieClip;
NOTE HERE: That the variable name MUST BE same as the name of the instance on stage.
So i can access it as : trace( a_Mc.b_Mc);
[Code]...
View 1 Replies
Sep 8, 2009
This site has a flash slideshow with multiple people in it that scroll left and right. The people are buttons with instance names.
When the user clicks on each person, it triggers some javascript that loads the corresponding swf for each person. Currently it only works for the first guy with a specific name in there.
[Code]...
View 1 Replies
Sep 8, 2009
This site has a flash slideshow with multiple people in it that scroll left and right. The people are buttons with instance names. When the user clicks on each person, it triggers some javascript that loads the corresponding swf for each person. Currently it only works for the first guy with a specific name in there. How do I get the instance name based on what the user clicks on to use?
[Code]...
View 2 Replies
Feb 3, 2011
I'm making a demo project for myself to learn. The project is somewhat similar to "The Story of Stuff" website.But I making this demo and going step by step. I have a small working project but the video clips are embedded and now I'm launching them externally using the flv playback component.I have only made the very first video clip external that is loaded in using the component. The rest of the clips are embedded.
As you can see I made this so when the picture icons appear and when you click on one the video pauses and when you click the close button on the small window that pops up the video resumes.(un-pause)
Basic time line controls. (Linear)
But of course this does not work when I load the clip externally using the flv playback component.My question is , how can I control (Play/Pause) the flv playback instance(s) with my existing icons?
View 1 Replies
Sep 15, 2008
I'm writing a video game and I have used timers all over the place to make everything go. Now I want to be able to pause the game, completely. Meaning, I need to stop and start all timer instances at once, or globally. So I created a Timer subclass called CustomTimer, put some statics in there, came up with the attached code. Now my problem is that I'm pretty sure I've created a memory leak, in that the instances array will just grow and wont allow or gc. So, my question is, is there an "onDestroy()" method or somesuch, that I can override, and use that moment to remove instance refs from the instances array? Or, is there a smarter way to do this? an application object with a pause method perhaps?
View 11 Replies
Jun 9, 2011
Im trying to dynamically add instances of a class. I need to do it in a loop. How would I go about doing something of that nature?
View 4 Replies
Sep 2, 2004
Is there a way to change an instance name dynamically?
View 2 Replies
Feb 11, 2009
I have a movie clip in the library. How can I dynamically create an instance of it, and how can I remove it (also dynamically)?
View 6 Replies
Aug 16, 2009
here is my code:
PHP Code:
var sp:Sprite = new Sprite();
sp.x = sp.y = 40;
addChild(sp);
[Code].....
I want different actions for different MCs, but I can't access my MCs. I gave them names btn.name = "btn" + i;, but whenever I tried using MCs instance name "btn0" or "btn1" and so on it didn't work. So what is an instance names for my MCs?
View 9 Replies
Jan 31, 2011
I'm trying to form an instance name dynamically.
Code:
var a:Array=[];
a=targetName.split("_");
turntoID = a[0]+1;
var popup = stage.addChild(["popUpMessage"+turntoID]);
But I get this error:
1067: Implicit coercion of a value of type Array to an unrelated type flash.displayisplayObject.
View 1 Replies
Dec 4, 2009
For AS 3
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..
View 1 Replies
Apr 11, 2011
I've added a movie clip dynamically using the following code:
var apie=new cPie()
apie.x=100
apie.y=100
stage.addChild(apie)
I now have a pie on my stage. Yum. Assuming this works like a movie clip placed on the stage by dragging and dropping, I added this in to change an instance in the pie.
[Code]...
View 2 Replies
Sep 20, 2011
I've worked out a way to get the proper instance name in stored in a variable (called listName), and I've got a SOUND_COMPLETE listener applied to my sound channel. What I need to happen is, when the function called by the SOUND_COMPLETE event fires, the object on the stage with the instance name that matches the string currently stored is affected.[code]...
View 3 Replies
Apr 8, 2006
This is my Code
targetMC = ["img_mc" + i];
infoTotal = targetMC.getBytesTotal()
How come when I use
img_mc0.getBytesTotal() it works
but not when I use
targetMC.getBytesTotal()
it returns NaN, even tho targetMC = img_mc0
View 2 Replies
Apr 5, 2007
Is there any way to dynamically give a movieclip an instance name? This little process is gonna be spread out to a couple hundred dots, and while it's not really all that hard to type in the variable by hand (in fact it'd "only" take half an hour or so), but the more done dynamically the better, I think.
What I want to do is have a simple movie clip which checks it's own instance name as a variable, and then gotoAndPlay("thatvariable");. For example, say I have a movie clip with instance name "a1". On the clip I'd like to put
onClipEvent (load) {
this.gotoAndPlay(_root.a1); //but in place of "_root.a1",
I'd like to be able to call the instance name so that I can copy and paste the code to multiple movieclips without manually changing the name.
}
_root.a1 is a variable which contains the name of a frame inside of a1, so when you boil it down, it's just telling itself to gotoAndPlay("framename") in a roundabout way. Is this at all possible?
View 11 Replies
Apr 26, 2009
What I have is a navigational button. On click, it adds a MovieClip that contains a SWF.This SWF is a third party news reader/blog. My problem is that when I click on another Navigational button, I can't remove the added SWF (whether I use removeChild() or unload()).The container MC that was added to hold the SWF is removed but the newsreader stays. I assume this is because, that while the newsreader itself works great, it has too many unremoved event handlers, connections.
My main problem is that I can't figure out how to call that added swf by it's name and where on the displaylist it resides. Because I really want to use this newsreader, I've come to accept that I can't remove it. What I'm doing instead is trying to set up a conditional that looks to see if this SWF is already on stage, if so, do nothing but make it visible again(don't re-add the SWF).This is what I have so far, but it's not working (or at least not working without error)
Code:
var blogNewsMC:BlogNewsMC = new BlogNewsMC();
function loadBlog(url:String) {
[code].....
View 3 Replies
Jul 3, 2009
In the following code I would like to be able to change which object the code affects depending on which parameter name is passed to it:
Code:
EventCentral.getInstance().addEventListener(ProjectEvent.SOME_EVENT, handleSomeEvent);
function handleSomeEvent($event:ProjectEvent):void
[Code].....
I could write it all out with ifs and else ifs for each parameter but this code is already part of quite a large structure and it would be more elegant to be able to do it with re-usable code.
I'm trying to do it is particularly idiomatic to actionscript anyway
View 1 Replies
Sep 18, 2009
I am working on a project at work that will be a data driven, county-by-county map of the United States. We have received a FLA file with all of the counties (3000+ of them) demarcated and placed properly. In addition each county is a unique movieclip in the library, with a unique library name. However, the instances on the stage have no name at all. In order to reference an instance it has to have a unique name, but I do not want to have to go through and name them all by hand as this could take me weeks. The names they have in the library are meaningful numbers (FIPS codes) and if I could just name each instance with the name it has in the library (since there are only one of each library movie clip in the stage) that would be great.
View 6 Replies
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.
Code:
button.addEventListener(MouseEvent.CLICK, addField);
var inputWidth = 200;
var inputHeight = 20;
[Code]....
View 10 Replies
Dec 29, 2010
I'm new to Flash Builder 4 and Actionscript 3 (actually, to programming as a whole beyond some very simplistic stuff). I have watched / read a bunch of tutorials, and started a project but now seem to have hit a wall. The answer is most likely simple, but seems to be alluding me.
How do I (or What approach should I take) to control visual elements, for instance, BorderContainer's, that I created dynamically?
As is, I have an Application containing a BorderContainer and a DataGrid. At runtime, 3 new BorderContainers (which are dragable, and resizeable) are created based on XML data that contains X & Y co-ordinates, and Height and Width values, and then added to the pre-existing BorderContainer. How would I go about getting the properties of these children BorderContainers to be displayed and remain up-to-date in the DataGrid (such as when they are moved/resized)?
View 2 Replies
Sep 9, 2010
I have a project where I dynamically generate a single tone and have to alter its frequency as the scene progresses. All the ways I have tried so far result in a clicking or popping noise when the tone's frequency changes. Does anyone have some source code for a way to change the frequency without the irritating click/pop noises?
View 8 Replies
Feb 20, 2012
I'm trying to define this function so I can pass the CardButtons sprite to the Add Cards function. It "works" but there's one problem: the CardButtons sprite used in the function is determined by the value of i at the time of the function call (or in other words, the value of i when I click the sprite).
I want the sprite passed to be literally the value of CardButtons[i] at the point when the function was defined.
CardButtons[i].addEventListener(MouseEvent.CLICK, CardFunctions[i]= function(){ AddCards(CardButtons[i],PlayerHand[player-1][PlayerHand[player-1].len gth-1]);});
Is there a way I can do this, or is there a better way to do what I'm trying to do?
I guess for further example:
I want CardFunction[0] to store the AddCards function with the value of CardButtons[0] passed, it should NOT be dependent on the value of i.
View 3 Replies
Mar 16, 2012
This is a very basic question. I'm rather new. Just wondering how one creates and manipulates dynamic objects, when they were designed in the library- not dynamically.
I want to make symbols in the library (linked to classes) and then dynamically create them and manipulate them in the actionscript code. But when I create them in the code, any instance names of sub-symbols cannot be referenced...
The instance name is "instance244" and not "leaf_text" which I set under [properties>instance name]
View 5 Replies
Apr 6, 2010
I have made basic code to draw boxes pending on user input. createEmptyMovieClip("box",_root.incramenting_var) ; how can i set an emty movie clips instance name dynamicaly? example: instance.box = "new_instance";
View 4 Replies
Aug 4, 2010
Is it possible to make an instance of a class dynamic at run time? So I can add properties to it?
View 3 Replies
Nov 6, 2010
I have an instance of button with a dynamic text field which is getting the text from an external txt file. What I am trying to achieve is to have it load from a different text file based on its instance name. The end result i want to achieve is each instance of the button has its own unique name based on its corresponding txt file, i assume this can be done based on its instance name.
The code I am using is below
ActionScript Code:
var button_text:LoadVars = new LoadVars();
button_text.onData = function (src:String):Void {
if (src != undefined) {
[Code].....
View 3 Replies