ActionScript 3.0 :: Setting MC Name Dynamically?
Feb 5, 2009
I have created a function to load up my movies what I would like to do is two things
(i) change the ldr to a movieclip
(ii) add an extra parameter to add an instance name movieclip when I call the movieclip
loadMyImage('images/headers/logo.png', 80, 20, 'myheader' );
View 5 Replies
Similar Posts:
Apr 28, 2010
I would like to set which axis is manipulated dynamically; or rather, I'd like to use a custom dynamic variable to set which proper variable to use.
Kind of like this: my_mc.x=55; or what i want to do is: my_mc.variableAxis=55;
View 2 Replies
Mar 7, 2009
I am creating an interface where a user can pick up "Polaroid" stle photos and shuffle them around a virtual desktop. I want to photo to shift it's transform point to match the point at which the user picked up the photo, to create a "swinging" effect as the photo is dragged.there was an AS2 workaround floating around, but I want to find the AS3 equivalent, and seem to be unable to find it in the Geom/Matrix package/classes.
View 3 Replies
Jul 2, 2010
I'm trying to read xml fields (with actionscript 3), but the problem is that I choose which field to read dynamically. For example, I may need to read test19 or test39 or test12 or anything else.
var value:Number = event.result.test19;
var value:Number = event.result.test39;
var value:Number = event.result.test12;
Is there a way to construct that event.result.test19 part dynamically? Something like the code idea below
[Code]...
View 1 Replies
Feb 10, 2009
I'm trying to dynamically set the addChild linkage identifier, but am having little luck.
Code:
for(i=0;i<6;i++){
if(i==this.myId){
var section:MovieClip = "section"+i
this.addChild(new section);
}}
In AS 2.0 I could simply do this:
Code:
attachMovie("section"+i, "section",0)
View 2 Replies
Sep 22, 2009
I need to set limits when generating a random number and this (code below) is just a temporary fix until I can set this limit dynamically.
The number is set to be between (0-4) by running an IF statement which sets a fixed upper limit. This works but I need the limit to update dynamically. My main goal is to use the numChildren property of an XMLList object (passed as argument) to set the maximum limit since the random number will be used by a loader when loading an image from this same XMLList.
Currently there are only 5 images in the XML file so this IF statement works. I would like to have the maximum limit update dynamically when the XML file has images added or subtracted to/from it.
[Code]...
View 3 Replies
Nov 10, 2009
I've automated a lot of my script, but cannot automate the very beginning where one sets the variables. I have the following script that I'd like to put in a "for" loop :
private var aliPlane1:Plane3D;
private var aliPlane2:Plane3D;
private var aliPlane3:Plane3D;
[code]......
View 9 Replies
Jan 25, 2011
I have a little issue im trying to resolve. Basically i want to inherit the embedded text format properties from one text field which i have off the stage (empty) to another text field i have on stage. Ive came across the function of getTextFormat(), however when i try to apply this to the other text field it doesnt work:
ActionScript Code:
onStageTextField.getTextFormat(offStageTextField);
Ive embedded italics into my test field which is off stage. I guess im doing this completely wrong?! I know i could simply create a new TextFormat() then apply that to the text field but is there a way of inheriting the format properties of one tex tfield to another on stage?
View 3 Replies
Jan 16, 2006
I have a number of functions and I want to execute 1 based on the entries in a .xml file
part my xml file reads as follows
<funcType>thisFunc</funcType>
In my .fla I have defined thisFunc along with a number of similar functions
I want to execute the function as follows
chosenFunc=Node.childNodes[0].childNodes[0].nodeValue;//points to thisFunc in the .xml file
chosenFunc(); // This should execute as thisFunc ()
Problem is this doesn't seem to be working. Am I trying the impossible?
View 1 Replies
Feb 18, 2012
I have a rquirement where i want to play the song based on the checkbox checked.I mean i want to set the flashvars parameter of swf object on click of checkbox to play respective song.I am using the tag for this is
[Code]..
in my website. Here i want to change the flasvars dynamically on checkbox(function as radion button) checked
View 1 Replies
Jan 5, 2010
I keep feeling like this is just a case of not RTFM hard enough, but I'm just not seeing the answer. Is there a way to use AS3 to dynamically set leading in a dynanmic text field?I've found the getLineMetrics function, which returns a TextLineMetrics instance. This instance can tell me what my leading already is, but when I try to change the value I see nothing change onscreen. Likewise, I don't see any setLineMetrics function to go along with the text field. Is there just no way to change it?
View 4 Replies
Jul 1, 2011
I am updating an older project, written in Flex 3 with some new functionality and I cant figure out how to do something that appears to be really simple.I am passing in data to a panel via XML and binding the properties of the panel to this XML, so for example:[code]My question is simple:How do I set the panel Title and Status colors using data that is passed in the XML?You can set titleStyleName to the name of a styledeclaration but the are no styles for titleColor or statusColor.
View 2 Replies
May 11, 2010
for each (var link:XML in settingsXML.links.link) {
menuItem = new MenuItem();
menuItem.menuLabel.text = link.@name;
[code]......
View 1 Replies
Feb 28, 2007
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.
View 3 Replies
Mar 2, 2008
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
[Code].....
View 1 Replies
Jun 15, 2009
I'm currently working on a project that involves adding text fields dynamically, and I realized I need to change the color of the highlight when the text is selected
View 2 Replies
Dec 22, 2004
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..
View 2 Replies
May 23, 2005
I'm using Flash Remoting to grab a result set from a SQL Server database. Then, using the total records in the result set, I'm creating the respective number of movie clips on the stage. Each of these movie clips is an instance of the "button_mc" movie clip I have in the library, named "button_0", "button_1", ..."button_n". The library movie clip that I'm using to create the instances contains a standard Flash button.
Anyway, that part is working fine. What I want to do is dynamically generate the onRelease event handler for each of these unique buttons. When I try to do this within the for loop, it sets all the event handlers to the last item in the list. What I want to do with the event handler is change the text of a dynamic text field based on the button name.
e.g. buttonName.onRelease = function() {
myDynamicTextField.text = "button_"+i;
}
In some ways it makes sense that the event handler is always going to be the last available in the loop, as the handler is called after the loop is completed. However, I'm hoping there's a way to make the handler "stick" after the loop is completed.
View 2 Replies
Oct 27, 2011
I have a game where i add some cartoonish ants, that when they are clicked, they need to be removed from stage. There are 4 differend kinds of ants, so im doing a Math.random for picking which one to add. (ant 1+2+3 have 50% chance to spawn and 4th 50%)
Code:
rnd_nbr = (Math.random() * 5)+1;
I have a timer doing 10 tick, and i reset the timer to make neverending. Then i have a math random and if sentences adding mc' to the stage with movement from Tweener, and event listeners for clicks. But i cant figure out how to remove them when clicked. I have done alot of failed tries right inside the click_candy_anty function. I've left them commented out.
Code:
import caurina.transitions.Tweener;
var ant_index:Array = new Array(10);//index for ants
var ant_number:int;
[Code].....
View 4 Replies
May 18, 2009
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.
View 2 Replies
Apr 2, 2010
[Code]...
That's the correct syntax for this? I want to be able to dynamically write to several textfields that exist on the stage but have not been dynamically placed there.
View 3 Replies
Apr 11, 2009
I want to set them up with packages but tried before and failed.At the moment, I've made a folder,
C:/flash/mbl
In there, I have all my classes that I want to reuse. what do I do next? I'm using Flash CS3, would also be useful to know how to do the same in Flex Builder 3.
View 6 Replies
Jul 11, 2009
not sure if this is technically "actionscript"but i didn't know wher eelse to post iti need to place an flv on top of a background image, and i want to set the flv to have an opacity of like 30%-
View 4 Replies
Dec 18, 2009
I can't figure out how to set a boolean variable to 'true' if someone clicks a checkbox. Help, please. I'm working on AS2, btw.
View 1 Replies
Nov 24, 2009
I have a bttn in my swf (which is embedded into my html page) and i want to be able to control the parameters of the pop up window the bttn generates. I have found a code generator at- this generator works when i input all my parameters and URL and test it, but when i place the code it provides onto the bttn in flash it fails to produce the same result me
on (release) {getURL ("javascript:NewWindow=window.open('https://secure.bellerockgaming.com/webchat/go_Max_New.asp?siteID=14&qu eueID=29&folder=BRE','Live
[code]....
View 1 Replies
Jan 14, 2010
I am just about to pull my hair out - please help as I don't have that much hair to pull out. I created a flash file in Flash CS3 and was told I need to add a click tag for an agency who want to keep track of the click throughs for the ad.
I have created the invisible button layer and set up the 'hit' and tried and tried and tried to select the button and add some action script to it. (which I have seen three different codes to use)
Each time I export it or publish it I get the error message: mouse events are permitted only for button insances on release. I have read and understand I need to assign the code to the button and not the frame but for the life of me, I cannot figure out how to do that.
I select the button (which I have converted to a 'button') and F9 or left click to get the Actions panel and once I am there and try to use the '+' to add code, it automatically shows 'Current Select/Frame 1 in the left side of the Actions panel. I get that it is adding the code to the frame but how do I get it to add the code to the button???
View 4 Replies
May 20, 2010
I have the following code:
[Code]...
All now works exept the height doesn't seem to work; that is, if the text goes on for pages all of it prints to screen. I would like to contain it to 350 px and then have the user use the scrollbar.
View 3 Replies
Nov 12, 2009
fla files which is calling default page . but it's not able to find the default page.. my default.aspx page is in root directory ,and my fla file is in ../capture/image.fla . here is my code
[Code]...
View 2 Replies
Oct 9, 2010
how to set value at a cell level in a data grid
I used the following
private function dataPanel(rowindex:Number, Var1:Number, Var1Name:String, Var2:Number, Var2Name:String, Var3:Number, Var3Name:String, Var4:Number, Var4Name:String): void {
trace("rowindex ", rowindex)
[Code]....
col1,col2, col3, col4 are id's for the 4 columns in data grid rowindex increments for value in each row...
it compiles and i get an error- it gets a strange error when i try to assign col1[].
View 2 Replies
Jan 27, 2011
For example:
sampleComponent.explicitMinWidth = 500;
sampleComponent.explicitWidth = 10;
Sets the width of the sampleComponent to 10, even though I've set the minimum width to 500.The same thing seems to happen with width. In Adobe's documentation, it states that 'measuredMinWidth - Specifies the default minimum height and minimum width of the component, in pixels. Flex cannot set the size of a component smaller than its specified minimum size.I've tried setting the measuredMinWidth as well, same result.Eventually, I tried every combination of minimum width settings I could, but they were all ignored when I set the width (or explicit width).
sampleComponent.measuredMinWidth = 300;
sampleComponent.minWidth = 300;
sampleComponent.explicitMinWidth = 300;
sampleComponent.width = 10;
Additionally, what is the difference between width and explicitWidth, in every case I've tried, they have performed identically (couldn't find any help on this either)
View 1 Replies