Dynamically Setting Properties Of A MC Instance. (using A Loop)
Hi I ran into a problem you might be able to solve.
In my application a number of similar MC’s will appear each time the user will press a button. the MC’s will appear randomly in different locations. Assuming there are 5 MC’s (movie1,movie2...) I would like to run a loop so each movie instance name will get one of 5 optional values:
-------------------------------------------------------------------
B=0
while(b<4){
pos=random(100)
eval("movie"+b+"._x = pos")
eval("movie"+b+"._y = pos")
b=b+1
}
-------------------------------------------------------------------
this script does not work, I understand that it might be because you can only read variables using 'eval' but not write them. however according to the Macromedia Flash MX help :
"You can also use the eval function to dynamically set and retrieve the value of a variable or instance name..."
how can I solve this and assign the X,Y property to each instance of an MC using a loop ?
Thanks.
FlashKit > Flash Help > Flash ActionScript
Posted on: 09-06-2002, 03:55 AM
View Complete Forum Thread with Replies
Sponsored Links:
Setting Properties Of Dynamically Loading JPEGs
I have a basic movie which dynamically loads JPEGs into a main movie file. I will update the JPEGs via FTP so this all works good for my client. However, I need to set a different location for the loaded JPEGs. They load into the upper left, top corner of the main movie. I need to somehow (setPropery?) set the _x and _y location that the JPEGs load into. I can not and do not wish to load via a button. I am not loading a library item or a swf file either, therefore setting the properties of an instance seems to be out as well. Preview what I am dealing with at: http;//www.ezzona.com/weiss/test.html
Any help is appreciated.
Jim
View Replies !
View Related
Setting Component Properties Of Dynamically Created Movieclip
Hello!
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
public function Information() {
trace("information created")
}
function setTitle(title:String) {
trace(this.titleLabel.text) //should print the actual text of the label, but prints undefined
this.titleLabel.text = title;
}
I am loading the "user interface" with the attachMovie function.
After that I am calling the function setTitle on the instance.
Code:
var information = this.informationPlaceHolder.attachMovie("information_id", "information", 1);
information.setTitle("Text for the label");
The function "setTitle" gets called properly. But it doesn't set the text of the label. The property "text" seems undefined. It is like the title label was "null". But I thought it gets instantiated over the symbol and linkage.
Anyone knows what I am doing wrong here?
Thanks for looking through.
-Iridium77
View Replies !
View Related
Dynamically Setting Instance Names For Attatched Mc's ?
is there a tutorial that covers this, or a basic feature of flash that i am missing that keeps action script in an attatched movie from running..
ie: i have a movie clip on the stage. it's job when clicked and dragged is to attatch an instance of itself to another mc.
this works.
however, trying to click and drag the attatched mc its as if no script is there at all.
am i missing something.. i am wondering if perhaps the instance name conflict thing is happening.. IF SO..
is there a way to get the instance name of an instance dynamically for use in actionscript?? var instance_name = this.instance_name ??
thanks
View Replies !
View Related
Modifying Different Object's Properties Dynamically In For Loop
well i'm kinda new to flash only been using it for about a week, so sorry if its a stupid question. but i have a for loop where this code it run:
code:
Object(_root.FullInterface.SoftwareButtons.Btn + String(i)).createTextField("btnText", getDepth()+1,-270, 168 - i*13,length(_root.OwnedSoftware[i])*6 - 1, 12);
Object(_root.FullInterface.SoftwareButtons.Btn + String(i)).btnText.text = _root.OwnedSoftware[i];
now i know the createTextField is all working because if i use this.creteTextField it works, but i dont want it in 'this' i want it in the object which in the case of i = 0, would be called
_root.FullInterface.SoftwareButtons.Btn0
i tried using the Object() function as you can see but it doesnt work, does anyone know what function i use to point to the correct object each time in the loop? i need it for the line below aswell as you can see since that doesnt work either.
the second line during i = 0 should be:
code:
root.FullInterface.SoftwareButtons.Btn0.btnText.te xt = _root.OwnedSoftware[i];
sorry if this is confusing, its confusing me as it is!
View Replies !
View Related
Refer To Text Instance Dynamically Within Loop
Hi all,
I'm fairly new to flash and trying to finish off an assignment using it.
Basically I have a for loop, and for each iteration of the loop I would like to modify the value of a different dynamic text box.
The loop counts down from 8 to 1 (working fine) and there are 8 corresponding dynamic text boxes. (named chosen1_txt, chosen2_txt etc)
The text boxes are in a movie clip (instance name is chosen_mc) on the mian timeline.
I am trying to build the path to the text field like so: (this code happens within the loop)
Code:
textField = "_root.chosen_mc.chosen" + i + "_txt";
textField.text = "desired value";
i is the variable used to move through the loop. I know the path and instance names are correct because if I hard code the path it works fine.
I suspect it is because the resulting textField var is a string that it doesn't work.
Can anyone tell me how to dynamically refer to a different text field on each iteration of the loop.
Cheers.
View Replies !
View Related
Dynamically Setting Labels Or Dynamically Setting Frames To Print
1. Does anyone know if there is a way to dynamically set a frame label. The reason for this is that I want a particular frame to Print with other frames (requiring a frame label of #p) if you answer a question a certian way and not to print with the other frames (needing a different label or no label at all) if the question is answered differently.
2. Option #2 would be to be able to dynamically set which pages print when you call the "PRINT" command (probulary through an expression). Any ideas would be appreciated.
thanks
View Replies !
View Related
Setting Properties
Is this:
for (var i = 0; i<10; i++) {
duplicateMovieClip ("line", "line"+i, i);
setProperty ("line1", _x, 50);
setProperty ("line1", _y, 50);
setProperty ("line2", _x, 150);
setProperty ("line2", _y, 250);
etc etc etc...
}
View Replies !
View Related
Setting Properties
I would like to have certain information displayed when you are viewing the flash exe icon.
how do you set certain properties like name, copyright information, description and website URL to an exe file?
and How do you change the icon from the F to a custom one in flash?
View Replies !
View Related
If/then And Setting Properties....
I apologize for posting what is probably a fairly simple questions for most of you.
I'm trting to create a single button to mute and un-mute audio.
My idea is to have a speaker icon on the stage, with a red circle and line through it over top. the volume would be set to 100 and the alpha of the circle-line (which is the button) set to 0.
When the user clicks on the speaker (hitting the transparent button over top) the audio mutes and the button shows.
I need to set the script on the button to check the alpha level and volume, and to set them from 0 to 100 or from 100 to 0 as appropriate.
I've been pouring through the ActionScript reference and can't find anything that accomodates this, and I don't know nearly enough to get what I need from the examples offered. (I didn't find anything in the help files about "volume" at all!).
I assume that the button would need appropriate script to handle something like the following:
if alpha of button = 0
then set alpha of button to 100
if alpha of button = 100
then set alpha of button to 0
if volume = 0
then set volume to 100
if volume = 100
then set volume to 0
Can anyone point me to a resource, or offer any assistance?
Thanks in advance.
Jeff Kenney
Toronto
View Replies !
View Related
Instance Properties
Hey-
I am new at this, and I can't figure out how to open the Instance Properties in MX. I am trying to create a popup menu, and the tutorial tells me to select "Track as Menu Item". How do I do this??
-Simon
View Replies !
View Related
Instance Properties
would anyone have any any idea as to why my individual class instances would be using the same parameter values as other instances? I don't have a single static parameter in the whole class but my instances properties are being overwriten by the values in other instances. I'm still fairly new to OOP but I think I understand enough to know that an individual class instance shouldn't use parameter values from other instances.
View Replies !
View Related
Setting Random Properties
I am trying to set random values for a movie clip (_x,_y,_alpha etc.)that will persist for the rest of the movie.
I am using:
rand = random(100);
_root.circ1._alpha=rand;
_root.circ1._x=rand*rand;
_root.circ1._y=rand*12;
on the first frame and then looping so that this frame never gets visited again.
This does not seem to work can anyone shed any light?
cheers,
George.
View Replies !
View Related
AttachMovie - Setting Properties Of Mc
Hi, I'm using the attachmovie command to put photos onto my stage. But I want to be able to set the size of the photo when it goes on the stage. I believe that the initObject part of the code below does it but I'm not sure how.
myMovieClip.attachMovie( idName, newName, depth [, initObject] )
If you know another way please let me know also.
Thanks heaps
View Replies !
View Related
[F8] Setting Properties From Movieclip
I am trying to set the _visible property of a button with instance name "continue_btn" at the root level from a button within another movieclip (placed at the same level as the button).
I use the following code, but it isn't recognized:
setProperty("root.continue_btn", _visible, "100");
also tried without quotes:
setProperty(root.continue_btn, _visible, "100");
Can someone tell me what I am doing wrong?
Thanks!
View Replies !
View Related
Setting Properties With HasOwnProperty()
Given an object and a string variable representing a property name, I can (for most purposes) use object.hasOwnProperty(string) to determine whether the property exists on the object.
Is there a way for me to set the property on the object using the string variable? In other words, I want to do something like this:
Code:
public var obj1:SomeClass = new SomeClass();
public var obj2:Object = {"prop1":"val1", "prop2":"val2", ...}
for(var i:String in Obj2){
if(obj1.hasOwnProperty(i))
obj1.i = obj2[i]; // how to address property "i" on obj1?
}
Thanks!
View Replies !
View Related
Setting Properties Of Loadmovie
I am trying to load a .swf into another swf. The problem is the movie clip that is being loaded is larger than the space that I want it to take up in the main swf. How do I load it where I want it and have it sized the way I want it? Please help. This is driving me crazy.
View Replies !
View Related
Instance Properties Menu
Hi! I'm trying to create buttons for a navigation bar using Flash 5 and the tutorial I have been following refers to an "Instance Properties" box that lists actions that can be assigned to each button. Trouble is I can't find this box!
There is an Instance box listed as a Panel but it appears to be completely different. Can you shed any light?
Also can I create all the buttons first so that they are evenly spaced and look good and can you offer any advice on this?
View Replies !
View Related
Instance Properties Question..
Hey guys.. I'm stumped.. I thought I understood how to access custom properties on a movie clip but I guess not.. the attatched file has the .fla file.. this is a chunk of piece I'm working on.. it is not finished and some of the comments won't make any sense.. the problem I am having is that once I duplicate a clip I want to then change some of the properties of that clip.. this I think should be a simple matter.. the code in question is on the main time line (the function buildBranch) and the properties of the instance of "branch"
thanks so very much for your help!
-Jake
View Replies !
View Related
Cannot Get/set Properties On Class Instance - Why?
I have several movieClips in my app that are linked to a class
I have extended the MovieClip class by editing the properties of the clip in the library to set linkage: Export for actionscript, Export in first frame and I have placed my class name in the field labeled AS 2.0 Class.
Sample - Symbol Properties dialog:
Identifier: kracko_btn
AS 2.0 Class: parkButton
Linkage: X - Export for ActionScript, X - Export in first frame
I have altered the classpath to include the path where (parkButton.as) containing the class parkButton resides.
An excerpt from the class code is as follows:
Code:
class parkButton extends MovieClip {
// stores URL for processEvent()
private var myURL:String = "None";
// stores media type for processEvent()
private var myType:String = "None";
function set theURL(myStr:String) {
this.myURL = myStr;
}
function get theURL():String {
return this.myURL;
}
function set theType(myStr:String) {
this.myType = myStr;
}
function get theType():String {
return this.myType;
}
function doesStuff():String {
return heresSomeStuff;
}
}
Note that I have created implicit set/getters. So I believe should be able to set/get properties with (class.property = value) syntax.
Also note that I have placed default values in the properties, so I should not later find that they are undefined.
On the 1st frame of my timeline I have the script:
Code:
import Buttons.parkButtons;
As a result of a parsing function that executes in frame 3 of the timeline the following code is executed to update properties of (kracko_btn):
Code:
this.kracko_btn.theURL = "http://www.moretothestory.com";
this.kracko_btn.type = "HTTP"
Following the parsing routing I do some tracing to see where I stand:
Code:
trace("kracko_btn.theType = " + this.kracko_btn.theType);
trace("kracko_btn.theURL = " + this.kracko_btn.theURL);
the resulting output is:
Code:
kracko_btn.theType = UNDEFINED
kracko_btn.theURL = UNDEFINED
The publish settings for the swf file have the classes exporting on frame 1.
I have done basically the same thing minus the XML parsing in another SWF file and it works fine. In the other example where it now works it didn't work at first. I changed the set/gets to frame 3 of the timeline (they were in frame 1) and it worked.
However, doing the same thing in this application does not help. What are the issues surrounding targetting these properties? I think I must be missing something.
An insight you can provide would be greatly appreciated. I'm stuck.
Kracko
View Replies !
View Related
Instance Properties And Methods
Kind of confused on them...
http://www.visiblearea.com/visdoc/ex...ons_Tween.html
I see that is basically takes Tween.as and breaks it down, but I use some of this for a project.
Can I use everything defined right there? Or to read this document do I just look at the constructor?
I know I can use yoyo()... but I'm not sure about all the other builtin functions and what they do...
View Replies !
View Related
Setting Properties Of Loaded Movies
I want to change the properties of a loaded movie (essentially make it invisible at first). I have used the following syntax, and it isn't working. boo hoo. Anyone got any ideas why? Help would make me most smiley at this frail point in my life.
loadMovieNum ("broadcast1.swf", 7);
setProperty ("_level7", _alpha, "0");
setProperty ("_level7", _rotation, "50");
trace ("not happening");
View Replies !
View Related
Problem With Setting Properties After Attaching
i have a clip in my library, itconsists of a button and an instance of a dynamic textfield called "trackNaam", i have linkage on.
i do this in my code
for (var i = 1; i<=Number(aantalTracks); i++) {
tellTarget (_root.myPlayer.myScroller.myContent.myItems) {
attachMovie("listItem", "currItem"+i, 1);
eval("currItem"+i).trackNaam.text= "hee";
eval("currItem"+i)._x = 117;
eval("currItem"+i)._y = 63+i*25;
}
}
eval("currItem"+i)._x = 117;
eval("currItem"+i)._y = 63+i*25;
works fine for
tellTarget(root.myPlayer.myScroller.myContent.myIt ems)
but
eval("currItem"+i).trackNaam.text= "hee";
only works for
tellTarget(root.myPlayer.myScroller.myContent)
or'higher'
In other words, i cannot set the text property after attaching the MC to the MC i want it in. Only in the ones above.
Can anyone help me with that? Please ??
View Replies !
View Related
Setting Properties Of Clips In Components
I'm running flash mx and i'm trying to set the x and y properties of a movieclip inside a scrollpane component. the movieclip is identified as thumbs as it is exported for actionscript in the first frame. the scrollpane has been named thumbwindow.
i tried
thumbwindow.thumbs._y = xx
but that didn't work.
i also tried just
thumbs._y = xx
I just need to know the path to that movie clip and I'm set.
Thanks in advance
View Replies !
View Related
A Trip...loadMovie And Setting Properties
Hello ppl!
Something simple but sticky...trying to load a swf into a flash file and set it's _x and _y using...
_root.onEnterFrame = function()
loadMovie("textanimate.swf",1);
//_level1._x = 124;
//_level1._y = 275;
setProperty("_level1", _x, "124");
setProperty("_level1", _y, "275");
}
where am i going wrong? Am loading both the movies for ur reference...
Wud appreciate some advise here...Thanx in advance!
View Replies !
View Related
Setting Properties For Movie Clips
I have a movie that begins with a movie clip on the stage.
How do I initialize the movie clip instance so that it is initially invisible. (I eventually want to use a button to make it visible)
I have not had problem setting the instance for commands such as play and stop, but can't get the _visible=false to work.
Where should this code be placed and what would be the right syntax?
View Replies !
View Related
Problems Setting Text Properties.
I have a textfield, for which I am trying to change the font size of.
I have the following code:
code:
var myformat:TextFormat = new TextFormat();
myformat.size = 50;
textFieldToPrint.text.setTextFormat(myformat);
On the stage I have a text field that has the name textFieldToPrint.
I'm going mad.
I can't see what's wrong with my code!?
Any help would be appreciated.
Thanks.
OM
View Replies !
View Related
Setting Properties For Attatched Clips
Hey everybody,
Okay, I'm extremely inexperienced in coding, comp sci, and action scripting, and I've accidentally gotten myself in a little over my head. I have what I'm hoping is a pretty simple question...here goes.
Okay, if I'm using the attach movie clip command, as i understand it, I'm telling flash three things with it:
"name of the movie clip I'm grabbing from the library (via a linkage name)", "name of the new instance of that clip that's created", and "depth of that instance." If I'm missing something there, let me know.
So...I want multiple copies of the clips to exist simultaneously, so I created a counter that allows the clip to be duplicated on different levels, so they don't destroy each other. This part is working alright I think. The problem is that I want to change the properties of these dynamically created movie clips, but I don't know how to properly target them in Actionscript....
Am I doing this semi right, or am I completely off? any help would be greatly appreciated.
What I have so far is:
on (rollOver) {
n = 1;
}
on (press) {
attachMovie("BallClip", "ball" & n, n);
setProperty("ball&n", _x, 400);
setProperty("ball&n", _y, 300);
setProperty("ball&n", _rotation, (angle*-1));
n = n+1;
trace("n="+n)
}
the "ball&n" thing seems to be working for naming the attached clip, but obviously that doesn't work as a legitimate variable elsewhere...so, what do I do???
View Replies !
View Related
Setting Properties On Predefined Objects?
In AS2 it was possible to set new properties on objects, for example:
ActionScript Code:
var mc:MovieClip;
mc['myReminder'] = "What I want it to be";
AS3 wont allow me to do this, but I would very much like to know if there's any good solution?
I'm using a Dictionary at the moment. So I have an entry in the dictionary, that will represent my own custom property. But this dosn't really seem to be the right thing to do, and in the long run it will not work.
Any ideas? Or is it possible, I feel I've missed something basic here?
View Replies !
View Related
Setting Properties Of Textfield Acc. To Ext. Vars
I want to load an external html into a textfield, but in don't know the length of the html file (number of characters are vary depending on which file is loaded). The size of the textfield must be equal to the number of characters that are loaded. I can send a variable with the text file to flash telling the number of characters.
Question: how can i tell flash to set the properties of the textfield (height) according to the value of the variable?
View Replies !
View Related
ActionScript: Setting Movie Properties
I need to set a movie clip, that serves as a floating menu, back to it's starting point.
I need to know how to set the xy position through script. I've been trying things with this so far, set on a button instance.
ActionScript Code:
on (release) {
with (_root.Menu) {
_x = 72;
}
}
something like that. Obviously it is not working.
View Replies !
View Related
Setting Properties Of Empty Movieclips
The problem I'm having is adjusting the _height and _width properties of an emptyMovieClip.
Here's me code:
for (var i=0;i<11;i++) {
// SET PROPERTIES
_root["uploadFileMC_" + (i+1)]._x = (10 * (i+2));
_root["uploadFileMC_" + (i+1)]._y = 10;
_root["uploadFileMC_" + (i+1)]._width = 240;
_root["uploadFileMC_" + (i+1)]._height = 240;
// CREATE A NEW CHILD MC
_root["uploadFileMC_" + (i+1)].createEmptyMovieClip("maskMC",_global.MCdepth++);
_root["uploadFileMC_" + (i+1)]._x = 50;
_root["uploadFileMC_" + (i+1)]._y = 50;
// THIS BIT FAILS!!!!!!!!!
_root["uploadFileMC_" + (i+1)]._height = 50;
_root["uploadFileMC_" + (i+1)]._width = 50;
}
Looking through the debugger the _x and _y properties get set but not the height and width!?!?
Any ideas? Is it because I'm creating an empty clip? I've also tried the attachMovie method linking to the library and again I can't change these properties.... Seems very stupid on my part - nay help greatly appreciated.
View Replies !
View Related
AS2: Manipulating Class/instance Properties? HELP
The mission: create multiple MCs (see the attachment) of a library item (a ball) that is linked with a class. At runtime, if user presses "q", ALL INSTANCES of that ball get bigger, instances get smaller, if user presses "a".
How did i try to solve it: with a for loop i cycle through all the instances and call a instance method to scale the balls.
The question: is there any way of doing this without the for loop?? What can i do to make this process less CPU consuming? Too bad, flash doesen't let (static) class methods to acces instance properties.
Need help!!!
Thank you!
Kekec
View Replies !
View Related
Calling Dynamic Instance Properties
I wrote this script to check how much a picture has loaded before loading the next picture in a duplicate movie instance. I get an "undefined" error when I run the script and trace the variable. I am using Flash mx and everything else works fine but this part. I've tried about as many ways as I can imagine and I can't figure out how to access the properties of a dynamicly named instance. Thanks
Code:
getname = eval("placeholder"+picture);
getloaded = eval(getname+".getbytesloaded()");
gettotal = eval(getname+".getbytestotal()");
trace(getloaded);
if (gettotal==getloaded) {
trace(loaded);
gotoAndPlay(7);
}
View Replies !
View Related
Pasting Scenes And Instance Properties
Hi there, I'm really noob on Flash and I'm working on a project, I was wondering if anybody could help me.
I've been carrying a huge problem, and it is that I want to make a webpage in flash, creating different scenes. Then I want each scene to represent a section in my webpage, so, in order to the user to notice that he is in a different section, I want to change the colors of my background, buttons and other graphs. What I want is the SAME BUTTONS AND GRAPHS ONLY TO CHANGE ITS COLORS. I've tried using effects like in order to modify each instance of the button by itself, but I've noticed that using that I'm still watching the background color I've used for my first section (for the Button itself, I mean).
After a couple of days I tried another thing, I've saved my project with a different name, changed colors of the buttons and stuff, but I don't know how to copy the scene I've created in the new file, in order to paste it in the original one.
I would appreciate help, as fast as you can help me. Sorry for my spelling, English is not my natural language.
Santiago
Im using Flash 8, by the way.
View Replies !
View Related
Concatenated Instance Names / Properties
title of this post is fairly vague so here's the general context; i've built an interactive map of sorts, with a set of districts marked off with all-enclosing boundary lines denoting their perimeter. each "district" is clickable and has been placed on the stage at the appropriate _x and _y coordinates to form the greater map. each district is a unique movie clip, with instances named sequentially "m1" thru "m19".
so here's the situation. i have a movie clip that is being placed on the stage at runtime via attachMovie(). the movie clip is one in a series of sequentially named clips, "static1" thru "static19" that corresponds to the similarly numbered "m" clip on the stage (as mentioned above). at any given time, only one of these "static" movie clips is placed on the stage, based on a number variable that I set manually. in essence, the "m" numbered clip and the "static" numbered clip form a pair. the "static" clip is effectively a 'highlight' that is introduced over top of it's corresponding district, and is being attached to an empty movie clip named "mDistrictArea". the newly instantiated clip recieves the name "mDistrictHighlight". (considering some other factors, this is the easiest way of meeting certain ends within the scope of this project. there are probably smarter ways of doing this but it more or less works the way i need it to.)
what i'm having trouble with is the number variable i've set manually at the onset. specifically, i'm trying to write the script around that number so i can use it to target the "m" clips programatically. something is flawed in my script though. here's a portion:
Code:
//--sets 'current district' variable and finds coordinates of district area
var nCurrentDistrict:Number = 15 (or whatever...)
var nXposition:Number = ["m"+nCurrentDistrict]._x
var nYposition:Number = ["m"+nCurrentDistrict]._y
//--uses value of nCurrentDistrict to determine highlight area
//----fills mDistrictArea with the appropriate highlight
_root.onEnterFrame = function() {
mDistrictArea.attachMovie(("static "+nCurrentDistrict), "mDistrictHighlight", mDistrictArea.getNextHighestDepth());
}
//----shifts mDistrictArea coordinates to appropriate location
mDistrictArea._x = nXposition
mDistrictArea._y = nYposition
where nXposition and nYposition equate to the _x and _y coordinates of whichever "m" clip happens to be targeted, according to the number specified for the nCurrentDistrict variable.
when i go to test the movie, the new clip is brought to the stage, but since i've placed mDistrictArea (the empty container clip) at 0,0 by default, that's where it gets placed and doesn't budge. i've traced nXposition and nYposition and i get undefined values. i've even gone ahead and substituted the values for both of those variables with the _x and _y coordinates of an actual instance name rather than the number variable, (like m15._x and m15._y for example), and sure enough the clip is placed at the appropriate coordinates. i'm almost positive there's something wrong with my syntax or how i'm concatenating the instance name. i'm just trying to figure out the proper way to get at the "m" clip's _x and _y properties, while still incorporating the nCurrentDistrict variable for actually determining which "m" clip is being targetted.
hopefully all this makes sense. as always, help is very appreciated.
View Replies !
View Related
Passing Instance Properties To AS2 Class
Hi Everyone,
I've been reading up on how to write classes in AS2. But so far, I've been somewhat confused. So here goes my list of questions.
I have a Button class that I am using in the FLA. As a simple test, I want to pass it's properties of width, height, and it's coordinate position - into the class GetMC.
Code:
import GetMC;
createClassObject(mx.controls.Button, "BTN", 5, {label:"Click Here"});
BTN.onRollOver = function() {
BTN.GetMC = new GetMC(this);
};
trace (BTN._width);
trace (BTN._height);
trace (BTN._x);
trace (BTN._y);
trace (BTN.width);
trace (BTN.height);
=======================================
Here is the Class file...
=======================================
Code:
class GetMC
{
public var xwidth : Number;
public var yheight : Number;
public var xpos : Number;
public var ypos : Number;
public var xxwidth : Number;
public var yyheight : Number;
function GetMC ()
{
xwidth = _width;
yheight = _height;
xpos = _x;
ypos = _y;
xxwidth = width;
yyheight = height;
trace (xwidth);
trace (yheight);
trace (xpos);
trace (ypos);
trace (xxwidth);
trace (yyheight);
}
}
Here's the problem...
When I trace out it's width, height, and x, y from within the class - it does not match the width, height, and x, y, from the FLA timeline.
I am assuming that I am not or have not passed it's properties correctly. Or am I not getting this class thing at all?
My biggest hang ups is passing any instance properties to the class for processing.
Any hints would greatly be appreciated!
Thanks!
BTW - Why is it when I trace out the button's width I get the following difference?
For example: a button 100x22, I'd get:
BTN._width = 5
BTN.width = 100
View Replies !
View Related
Getting Properties (.x, .scaleX Etc.) From Instance On Stage
I've been searching the answer to this for about a two days (first AS3.0 project).
There are two slider buttons on the stage. These control the rotation and scale of an image on the stage. The slider buttons uses the SliderClass class, the image uses the ImageClass class (see attachment)
First the question:
How can I adress an instance that i've placed on the stage in the CS3 IDE.
Explanation (see attachment):
The sliders work just fine, but I can't get the slider's coordinates from within the ImageClass (1120: Access of undefined property scaleSlider).
With previous actionscript versions I just used _parent etc. But I don't think that's right anymore (plus I don't know the "location" of an instance relative to a class to use _parent etc. to get somewhere).
Thanks in advance!
P.S: If you've got some extra tips when you look at my files PLEASE share them!
(English is not my main language, so I hope this story makes any sense.)
View Replies !
View Related
Error With Transition / Instance Has No Properties
I'm having trouble making transitions in Adobe Flash CS3 Professional. Here's the error message:
Exception in exportPreviewSWF: TypeError: instance has no properties
Error opening URL 'file:///C|/Users/Lindsey/AppData/Local/Adobe/Flash CS3/en/Configuration/preview1.swf'
Exception in reverse: TypeError: tmpFrame has no properties
Any help would be wonderful.
View Replies !
View Related
AS2 Instance Properties Initialization Problems
Hi!
I have the folllowing class, the problem is that if I create an instance of it and I run in debugg mode the debugger doesn´t show me it´s properties but if I trace them they are traced correctly.
The problem that it causes is that if I pass an instance of this object to a component or movieClip as it´s initialization object the properties are not set, unless I reasign them values first.
It also works if I just declare the properties but I initialize them in the class constructor.
I think it should also work as I´m trying now.
Any ideas why this issue happens?
regards,
Polaco.
ActionScript Code:
class StandardMenuItemStyler extends Object
{
public var blur:Number=6;
public var bevelDistance:Number=10;
public var bevelStrength:Number=6;
public var bevelAlpha:Number=0.8;
public var bevelQuality:Number=3;
public var borderWidth:Number=4;
public var borderColor:Number=0x222222;
public var shadowAlpha:Number=0.8;
public var shadowQuality:Number=3;
public function StandardMenuItemStyler(){
shadowQuality=3;//this property is showed in the debugger
//the others aren´t showed in the debugger
}
}
View Replies !
View Related
Setting Properties And Calling Functions After Loadmovie
I have a series of external .swf files that I want to load into a container movieclip on my top level timeline using Flash MX and AS1. I'm quite happy doing this using loadmovie and checking getBytesLoaded and getBytesTotal to determine when it's loaded using a setInterval function.
What I would like are some suggestions to solve the following problems:
1. I have a number of top level timeline defined variables that I would like to use to create custom properties on the container movieclip into which I am loading the external .swf files. I'd rather not write code in each external .swf to access these directly from the _parent timeline because I may change the relative location of these variables at some point in the future. I would also prefer not to use the _global namespace either as it is too difficult to manage effectively. My preferred approach would be to write some code on the top level timeline to assign the properties to the container movieclip at an appropriate time for the external .swf access in frame 1. One approach I have tried is adding a query string to the end of the loadmovie URL but this has the problem that it doesn't work when running the movie through the standalone Flash player which will impact our development turnaround. Are there any other techniques which will allow me to create the timeline variables in the container movieclip before the code in frame 1 is executed?
2. The external .swf files that I am loading are single frame movies and have a number of timeline functions defined in them in the first frame that I would like to call from the top level timeline. As far as I understand it these functions are not defined until the playhead of the movieclip's time line has passed through the first frame once.
One approach I have tried is to check if the functions are defined before I call them. This works but is not a generic solution since the external movies have a range of different functions with no common functions between them all. Again I'd rather not write any code in the external .swf files that ties them into the environment into which they are being loaded in case this changes in the future.
Another solution that I have tried is adding this code to the top level timeline:
MovieClip.prototype.onEnterFrame = function() {
this.onEnterFrame = null;
this.movieLoaded = true;
};
and then checking for the movieLoaded property on the container movieclip in a setInterval function prior to calling the functions. As I understand it the prototype defined onEnterFrame function is executed as the playhead enters frame 1 and is then set to null. When the movieLoaded property is true I can be sure that the playhead has passed through the 1st frame at least once. Any onEnterFrame functions defined in frame 1 are not affected by this code as their definition happens during frame 1 and is only current on the second onEnterFrame event. This approach falls down if there is an onEnterFrame event defined in the external .swf files in a #initclip block which would be executed before frame1. In my case I know is not true but I am seeking a general solution. Any other ideas?
Thanks for your help in advance.
Martin.
View Replies !
View Related
Setting Properties Of An Externally Loaded Component?
Hi all...
I am having some difficulty figuring out how to control a component's properties in actionscript in an external swf.
Is this possible (ie. in movie A could i load a movie B with a scrollpane, say named "component_mc" , and in Movie A use actionscript to specify setSize or setScrollContent) ????
Specifically i am using the MultiOutlet component (a component that allows you to store multiple resources such as graphics etc. like a shared library, but also with components so you don;t have to reload them each time but share them)
The multioutlet component works fine (get it at http://www.flashcomponents.net)
loading the scrollpane, but i cannot figure out the syntax or where i should put the actionscript in the movie containing the multioutlet component (not the scrollbar movie/library which the component loads) to dynamically change the component's properties...
Please help! Thanks
-aleks
View Replies !
View Related
Properties Setting For Full Screen Website.
Im wanting to load images that take up the whole background of my site. At the moment I have my properties at 1074x768px
However after setting the html settings as instructed in the link below:
http://www.kirupa.com/developer/mx2004/fullscreen.htm
I notice the image has been stretched a little. Is there a way round this other than making my image and property sizes bigger than 1074x768? If this is the case what size should I make them?
View Replies !
View Related
Setting Properties In The AuthEnv And In Throuhg ActionScript; Cant Mix The Two?
hello everyone.
I've been experimenting and in my general experience it seems that once a property of a particular MC as modified via ActionScript that same property cannot be modified anymore by authoring environment tweens...
example... tweening the alpha property of a rectangle works for as long as I dont modify the ._width of the rectangle...
as soon as the code that does modify that property is done tweening the ._alpha property of that same rectangle does not work anymore.
can anyone tell me why this might be, or confirm that you can only modify properties either through AS or in the authEnv, but not both
thank you very much for the help
all the best
ivan
View Replies !
View Related
How Do I Convert The Setting Properties Command In Flash Mx
How do I convert the Setting Properties command from flash 4 or 5 to flash mx on page 5 to 9 on this flash movie
Can someone explain to me how do i Setting Properties in flash mx action script.
How do I convert the Setting Properties command from flash 4 or 5 action script below to to flash mx from page 5 to 9? The web site link of this movie is below…
http://www.flashkit.com/tutorials/In...-192/more9.php
Set Property ("/circle_in", Alpha) = 0
Set Property ("/triangle_in", Alpha) = 0
Set Property ("/square_in", Alpha) = 0
And
GetProperty ( "/circle_out", _droptarget ) eq "/circle_in"
Drag 'n' Drop IQ Test
http://www.flashkit.com/tutorials/In...-192/more5.phphttp://www.flashkit.com/tutorials/In...-192/more9.php
View Replies !
View Related
|