See Related Forum Messages: Follow the Links Below to View Complete Thread
I Need To Move(drag/drop) A Dynamically Made Movie Clip
the clip is being made
like so
Code:
_root.contributionMC.contributionSP.spContentHolder.attachMovie("outlineMainMC", outline[cId], attachAt);
from what i understand, outline[cId] is the instance name, which in this case is contribution1, contribution2 and so on.
i have a button that holds the move code behind the scenes in the outlineMainMC clip, it's actions are:
Code:
on (press) {
startDrag ("contribution1"); //just grabbing the first one for now for testing purposes
}
on (release) {
stopDrag ();
}
what am i doing wrong
How To Change Instance Name Of Movie Clip Dynamically?
Dear,
Is there any way to change instance name of movie clip dynamically?
Suppose, there are...
Button A named 'a1'
Button B named 'b1'
Button C named 'c1'
Movie Clip named 'm1' with instance name 'm1'. (this constains button 'c1').
if I press Button A then, I want to show movie clip 'm1' with instance name 'm1'
And if I press Button B then, I want to show movie clip 'm1' with instance name 'm2'
To make a long story short, I want to change instance name of movie clip dynamically.
Is this possible?
Thanks in advance,
Yung
Dynamically Creating Instance Name Of Movie Clip
Hi everyone
a shove inthe right direction very much needed.
I have a movie clip (Lets call it mc01.swf) that I am loadin on my main movie.
this movioe clip is loaded inside an empty container in my main movie. the contaner mc han instant name "contmc"
I want to stop the loaded Mc i.e mc01.swf whcih is loading inside the empty container.
any idea how i can target the time line of teh loaded movieclip??
thanks for your help
P.S. im using flash MX
Dynamically Load Text Into Movie Instance
I have looked all over for a way to do this and can't seem to find one.
I have a movie clip with a text box in it. I want to place three instances of this movie clip on a web page and have each instance have different text in the text box. The instances are menu choices, so I want each on them to open a new web page.
My question is, how can I dynamically load different tet into each instances text box.
P.S. I am fairly new to flash.
Dynamically Calling Movie Clip Instance
Hi there,
I'm trying to reference an instance of a movie clip without using the exact name. This is hard to explain so I'll give you the example:
I have 6 movie clips: (mc_movie1, mc_movie2, mc_movie3...etc)
I also have 6 buttons. when I press button two for example variable 'button_pressed' is set to 2.
Now, I'm trying to affect the movie clips depending on which button is pressed.
so what I want to know is how to write, for example : mc_movie(button_pressed)._x =100;
....where the (button pressed) value will mean this action will affect mc_movie2
if it was a string it c would be: "this is string number" + button_pressed +" of 6"... so how can i achieve this when it's an instance name?
very hard to explain, hope you guys understand and can help!!
cheers
Dynamically Calling Movie Clip Instance
Hi there,
I'm trying to reference an instance of a movie clip without using the exact name. This is hard to explain so I'll give you the example:
I have 6 movie clips: (mc_movie1, mc_movie2, mc_movie3...etc)
I also have 6 buttons. when I press button two for example variable 'button_pressed' is set to 2.
Now, I'm trying to affect the movie clips depending on which button is pressed.
so what I want to know is how to write, for example : mc_movie(button_pressed)._x =100;
....where the (button pressed) value will mean this action will affect mc_movie2
if it was a string it c would be: "this is string number" + button_pressed +" of 6"... so how can i achieve this when it's an instance name?
very hard to explain, hope you guys understand and can help!!
cheers
Dynamically Give All Movie Clips Unique Instance Names?
is their a way to dynamically give all movie clips unique instance names?
Example:
I have 20 different MCs without instance names and when it loads or exports (doesn't matter to me) it will give instance names like p1, p2, p3, p4, etc... to all the MCS
Possible?
[F8] Problem With Attaching Movie Clips With Dynamically-generated Instance Names
Will something like this create and attach separate movie clips onto the stage with different Instance names?
Because I'm having a problem where each one of the attached movieClips will display the exact same information, which would be the information sent to the last movieClip created. I'm assuming that my problem is that I'm creating their Instance names incorrectly, since when I try to trace the names out (eg panelIndex0), it comes out as undefined.
code: for (currentPanel=0; currentPanel<totalPanels; currentPanel++) {
// identifies and creates appropriate Instance name for the current panel
thisPanel = eval("panelIndex"+currentPanel);
// creates the new panel with its own Instance name (eg panelIndex0, panelIndex1, ...)
attachPanel = attachMovie("GameDescriptionPanel", thisPanel, this.getNextHighestDepth());
}
Is there any way to find out if my panels are indeed coming out with different Instance names?
Play MC When Instance Visible
hi guys.
i've been trying for hours, and im finnaly asking for help.
anyway, i have an instance of a movieclip (a heart pumping). basically i got some buttons that show+hide the different organs of a body.
now i need to start the heart animation at the begining each time i change it's visiblity to 1 with the button.
How can i do this? in frame 1 of the heart pump MC, i threw down a if visible = 1, then gotoandplay 1, if heart vsible =0, gotoandstop 1. (obviously not real code).
anyway, it doesnt work, and its all coded right. any other suggestions? i cant seem to find a way in the help files to do a gotoandplay on a movieclip from the outside, it just does changes the scene (can you target a certain MC?) i got no idea.
something i could add to the button is what im thinkin i gotta do.
help? thanks!
-drpd
Help With Visible=true/visible=false Animated Movie
in my main timline
action layer:
PHP Code:
stop();
_root.attachMovie("mcNavi","mcNavi",1);
mcNavi._visible=false;
_root.attachMovie("mcContact","mcContact",2);
mcContact._visible=false;
in another layer labeled buttons, one button "Contact Us" has the following script:
PHP Code:
on(release){
mcContact._visible=true;
mcContact._x=115.8;
mcContact._y=165.3;
mcNavi._visible=true;
mcNavi._x=459.6;
mcNavi._y=29.1;
}
in the mcNavi movie clip there is a button labeled Close Window with:
PHP Code:
on (release){
_parent.mcNavi._visible=false;
_parent.mcContact._visible=false;
}
all the movies can be seen when needed however, once you click "Contact Us" to see mcContact and click "Close Window" to remove it, then every time you open "Contact Us" to see mcContact it won't show the animation, it will only show the end frames.
how do i get around this. is there other actionscript i should use for animated movie clips other than:
visible=false; and visible=true;
??????
Is There Anything Wrong With How I've Made These Instance Names For These MovieClips?
For context, I've created a library item with a linkage name called "livesIcon". I want to place them on the stage sequentially, which was successful. The problem is simply referencing them later on.
code: var livesIcon:MovieClip;
var currentIcon:Object;
var lives:Number = 3;
[...]
for (l = 0; l < lives; l++) {
currentIcon = eval("livesIcon"+l);// creates "livesIcon0", "livesIcon1"..
livesIcon = attachMovie("livesIcon", currentIcon, l+20, {_x:l*50+50, _y:350});
}
At the moment, I have no problems with these Instances appearing where I want them to (mainly because of that last parameter in attachMovie().), but for some reason, the Instance names don't respond when I reference to them either via my currentIcon variable or by their specific names.
For example none of these lines of code seem to do anything to the Instances I just made:
code: livesIcon0._y = 0;
currentIcon._y = 0;
Is there anything wrong in the way I made them?
Linking Back To Scene 1, Frame One, From Popup (made From Instance)
Okay im a noob, and i want to create a quit button that asks the user are they sure.. ive got the cancel button to work.. but when i click the confirm button it does nothing...
Ive set it to gotoandplay.. Scene1 and frame label (which is really frame 1, set to menu)
But nothing happens... HELP!!!
Could This Be Made Dynamically (array)
Is it possible to make this dynamically?!:
tr0 = new Array;
tr1 = new Array;
tr2 = new Array;
tr3 = new Array;
tr4 = new Array;
tr5 = new Array;
tr6 = new Array;
tr7 = new Array;
tr8 = new Array;
tr9 = new Array;
Happy weekend to all of you!!
Deleteing Dynamically Made Text Field?
I'm trying to call a function to populate a movie clip with x amount of text fields, but I'm having a hard time deleting ones i may have already made. This is just a prototype of the functionality, and it doesn't work, any ideas how to delete a textfield in an mc from a function on the root?
code:
function initiate(){
this.createTextField("txt",1,20,20,510,40)
txt.text = "Shouldn't this text delete when the button is pressed";
txt.align = "center"
this.createEmptyMovieClip("button", 3);
button.beginFill(0x336699);
button.moveTo(20,65);
button.lineTo(80,65);
button.lineTo(80,95);
button.lineTo(20,95);
button.lineTo(20,65);
button.endFill();
button.onPress = function(){
delete(this._parent.txt);
}
}
initiate();
Thanks
_b
I Made A Dynamically Loading Photo Gallery
I made a dynamically loading photo gallery with thumbnail buttons that you press and it loads a bigger picture dynamically. Now, I want to learn how to dyynamically load flvs (videos) into the same xml file space --- is it possible?
Set Instance Name Dynamically
I know how to read what the instance name of an object is and I need to be able to set the instance name of an object with actionscript. Here's why:
I'm creating a scrolling list of buttons that stack on top of eachother. The number of buttons changes. One day there could be 50, another 30, etc... The buttons are created at run time using actionscript and I need to be able to set the button instance name at that time. I'll be doing this in a loop so the button names will be 1,2,3,4, etc... Not that it matters, but the reason these are done sequentially is because the instance name is used as an integer value to be passed to a function that uses the pointer to locate correlating information in an array.
The number of buttons will be variable and will change from day to day so this is why I need to assign instance names on the fly.
In summary: How do you set an instance name of an object (button, movie clip) with actionscript.
Thanks,
Joshua
Set Instance Name Dynamically
I know how to read what the instance name of an object is and I need to be able to set the instance name of an object with actionscript. Here's why:
I'm creating a scrolling list of buttons that stack on top of eachother. The number of buttons changes. One day there could be 50, another 30, etc... The buttons are created at run time using actionscript and I need to be able to set the button instance name at that time. I'll be doing this in a loop so the button names will be 1,2,3,4, etc... Not that it matters, but the reason these are done sequentially is because the instance name is used as an integer value to be passed to a function that uses the pointer to locate correlating information in an array.
The number of buttons will be variable and will change from day to day so this is why I need to assign instance names on the fly.
In summary: How do you set an instance name of an object (button, movie clip) with actionscript.
Thanks,
Joshua
Getting The Instance Name Of A Symbol Dynamically
hi,
maybe i'm having a brain fart. but is there a way to get the instance name of a symbol w/ a/s?
the scenario: i have a button symbol named "button." i want to have several instances of this button on my stage. each button will have different dynamic text over it. these texts will have instance names "button1Text" "button2Text" etc and the button instances will be named "button1" "button2" etc, respectively. i will have a script on the button that looks something like this:
pseudocode:
Code:
on(rollOver){
bttnInstanceName = this._______;
myText = bttnInstanceName + "Text";
myText.text = rollOverText;
//obviously there is a problem here since myText is a string and
//I'm trying to target a text instance name and set it to a
//predetermined variable "rolloverText"
}
any tips? advice? other approaches that may accomplish the same thing? basically i am trying to make a master button that doesn't have to be altered to be used all over the place. thanks.
Dynamically Set Instance Name Of An Object?
I have never had to do this but i am sure it Will be pretty easy to do.
dynamically set instance name of an object.
Example
code:
for (count=0; count<varCount; count++) {
this.attachMovie("holder", "clip"+count, count);
this["clip"+count]._y = nextY;
this["clip"+count].varID = result_lv["clip"+count+"varID"];
this["clip"+count].theButton._name = this["clip"+count].theButton._name+count
nextY += 96;
}
So "theButton" would then become "theButton1" "theButton2" etc.
Thanks
Paul
Getting Instance Names Dynamically
This should be pretty simple, but I'm not sure which functions I should be using.
All I need is to be able to get the instance name of a movieclip when I click on it. I'm sure it has something to do with targetPath, but not sure on how to utilize it...
This would be enough to get over the hump.
Thanks in advance!
Dynamically Naming Instance
OK so i am going from as1 to as3 - and having problems with the following.
I can create multiple instances of a Ball from my library i.e
ActionScript Code:
package {
import flash.display.MovieClip;
import flash.display.Sprite;
public class SetUp extends Sprite {
public function SetUp() {
init();
}
public function init() {
var site:MovieClip = new MovieClip();
addChild(site);
for(var z:int = 0; z<10;z++){
var myBox:Box = new Box();
site.addChild(myBox);
}
}
}
}
In the old days you would do something like:
ActionScript Code:
for(var z:int = 0; z<10;z++){
site.attachMovie(myBox, ["myBox"+(z+1)], z);
}
then you could reference each box i.e.
site.myBox2.doSomething
I am wondering if within the As3 version you can name each instance differently and also how to reference them - for example if i want to make one of the invisible of even remove one of them
Please help - i am a little confused....
Dynamically Set Instance Name Of An Object?
I have never had to do this but i am sure it Will be pretty easy to do.
dynamically set instance name of an object.
Example
PHP Code:
for (count=0; count<varCount; count++) {
this.attachMovie("holder", "clip"+count, count);
this["clip"+count]._y = nextY;
this["clip"+count].varID = result_lv["clip"+count+"varID"];
this["clip"+count].theButton._name = this["clip"+count].theButton._name+count
nextY += 96;
}
So "theButton" would then become "theButton1" "theButton2" etc.
Thanks
Paul
Defining Instance Names Dynamically
Can someone please help me out with this one.
I want to make a mouseover for a button that I have using actionscript.
I'm using
loadMovieNum("blah.swf", 1);
but instead of having it load in the middle of the stage and repeat I want to be able to control where it's located and how many times it plays, and various mouseover attributes.
loadMovieNum doesn't allow an instance name to be assigned. Can someone please help me out.
Thanks.
Instance Name For Dynamically Attached Movieclips
This was posted in the Actionscripting forum but I didn't receive much response there so I hope someone can help me here. I have a complex problem here (to me at least) so pls hear me out. This is how I retrieved records from my SQL db and use it to create many instant movieclips on my movie:
code:
myClient = new LoadVars();
myClient.load(noCache("drawicons.aspx"));
myClient.onLoad = function() {
var x = 1;
while (this["cpuname" + x] != undefined) {
_root.attachMovie("client", "pc" + x, x, {_x:this["xmouse" + x],_y:this["ymouse" + x]});
_root["pc" + x].CPU_Name = this["cpuname" + x];
_root["pc" + x].CPU_Category = this["category" + x];
_root["pc" + x].CPU_IPAddress = this["ipaddress" + x];
_root["pc" + x].CPU_MACAddress = this["macaddress" + x];
_root["pc" + x].CPU_SerialNumber = this["serialnumber" + x];
_root["pc" + x].CPU_Type = this["type" + x];
_root["pc" + x].CPU_Model = this["model" + x];
_root["pc" + x].CPU_TotalMemory = this["totalmemory" + x];
_root["pc" + x].CPU_TotalSpace = this["TotalSpace" + x];
_root["pc" + x].CPU_AvailableSpace = this["availablespace" + x];
_root["pc" + x].CPU_OSName = this["osname" + x];
_root["pc" + x].CPU_OSBuild = this["osbuild" + x];
_root["pc" + x].CPU_Location = this["location" + x];
_root["pc" + x].CPU_Area = this["area" + x];
x++;
}
}
Each of this movieclips represent a computer and thus have 3 Frame Labels: "online"(Default), "offline" and "found" to represent different state.
The problem is this: How do I refer to a particular movieclip (computer) by the cpuname so that I could execute the gotoAndStop action to switch it to a different state? Another problem is how do I link these dynamically attachmovie instance name to the cpuname?
One of the forumers suggested this but it caused the whole loop to fail:
code:
var n= this["cpuname" + x];
_root.attachMovie("client", n, x, {_x:this["xmouse" + x],_y:this["ymouse" + x]});
n.CPU_Category = this["category" + x];
n.CPU_IPAddress = this["ipaddress" + x];
n.CPU_MACAddress = this["macaddress" + x];
n.CPU_Type = this["type" + x];
n.CPU_Model = this["model" + x];
// and the rest of it.
//then to apply an action later of to the mc, use:
mycpuname.gotoAndStop(label);
Pls help me as I have searched the forum, thanks for your time.
Changing An Instance Symbol Dynamically
I'm creating a preview window for a flash I'm working on, and I have several animation that I would like to show up in the preview window based on what button you pressed. I can't figure out a way to make a single instance of a movieclip, then change what movieclip it is displaying at run time. I think I can do it by attaching the movie clip to root, then deleting it and creating the new one. However, I don't want to have to delete & recreate a clip each time they press a button, I just want it to dynamically swap to a different clip, is this possible?
Changing Instance Names Dynamically
Can you change an instance name of a text field using buttons? I tried:
[HTML]on (release) {
Story_txt0._name = "Story_txt1";
}[/HTML]
But that, of course, doesn't work? I want to change the instance name of the fields so they display different content based on the instance name. Any ideas?
Dynamically Changing Color Of An Instance?
I know that the _alpha property can be changed using code, but I need to use code to actually manipulate the color of an instance.
Is there a way to do this, or is _alpha only manipulated in terms of opacity?
Thanks,
+Q__
Syntax Help With Accessing Instance Name, Dynamically...
Hey guys, n00b needs help,
I need to play a movie clip whose instance name is set into a dynamic text field. Say, if I were to have a dynamic text field named 'holder', containing the instance name 'mc1', how would I play it?
Considering incorrect syntax, this is what I'm trying to do:
Code:
_root.holder.text.gotoAndPlay(10); //which is incorrect
alternatively,
Code:
var instance_name = _root.holder.text;
_root.instance_name.gotoAndPlay(10); // which is also incorrect.
Hope I'm making sense. That ^ is what I wanna do but I'm looking for the right syntax.
HALP!
Dynamically Rename Instance Names
point of depature:
i have three embedded video, called myVideo0, myVideo1, myVideo2;
i have a function which loads a new movie, when the cursor moves over the video (i.d. if(_root._xmouse > myVideo0._x && _root.ymouse > myVideo0 a.s.o)
i have switch cases which video shall be loaded when you move over, which means:
case1:
myVideo0.attachVideo(stream_ns0);
case2:
myVideo0.attachVideo(stream_ns9);
a.s.o.
then I have a function so that when you click on the Video, the next myVideo1 will be the one where the mouse will work.
as a result i have 3 switch cases, 3 mouse functions for every video because of _x and _y.
How can I do it dynamially, like myVideo+number1
Please help me!
/Pukki
Dynamically Remove Button Instance?
OK, I've tried a bunch, and can't seem to get this to work. Is there any way to remove a button instance using something similar to removeMovieClip. I cannot convert the instance to a MovieClip as the button is being used in many other clips, changing it would be a pain at this point. THere has to be a way to do this, and if there is not, thats a pretty big oversight on MM's part.
Dynamically Creating An Instance Of A Graphic
Ok, so I've got a graphic (or a movie clip) in my Library. (I'm Using Flash MX)
I'd like to (using ActionScript) dynamically create an instance of that graphic and place it on the stage (specifying the X and Y position).
How would I go about doing this?
Thanks
IC
How To Dynamically Give MC An Instance Names?
Now I have this code which is loading all the images from the xml file into a container and I need to set some ID to track which image should be opened bigger in another MC.
And I also need to use this ID to when user hovers mouse over an image it scales up a little using tweener.
Code:
private function loadThumbs():void
{
for(var j:uint = 0; j < thumbs.length ;j++)
{
MC = new MovieClip();
MC.name = "number " + j;
MC.x = j * thumbsSize;
imgLoader = new Loader();
imgLoader.load(new URLRequest(thumbs[j]));
MC.addEventListener(MouseEvent.CLICK, onClick);
MC.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
MC.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
MC.addChild(imgLoader);
container.addChild(MC);
}
addChild(container);
}
When I trace MC.name at onClick event it shows the instance name.
How should I do?
Instance Names Dynamically In Runtime
Hi, I am a newbie on action-scripts. I want to be able to use variables names dynamically in runtime. I will try to explain…
Loop...
For (i=0; i<=x; i++) {
‘instanceName’+i.text = ‘loadvariable.formTexfile’+i;
…
}
First I have a text file with some variables. I have named my text file to ‘myText.txt’ and it is located within the same dir as my fla. file. The data in ‘myText.txt’ looks as following…
//file myText.txt
name1=Hello World
&name2=Hello Moon
&name3=Hello Earth
…
I have used the text tool and created text-fields on the stage. I have put the properties to ‘Dynamic Text’ and given each of them an ‘Instance Name’ as following…
myTextBox1
myTextBox2
myTextBox3
…
I have looked in the text_start.fla, that comes with flash MX, the lesson about starting with text, and found this code…
Features_lv = new LoadVars();
Features_lv.onLoad = onText;
Features_lv.load("myText.txt"); //Features_lv.load("safetyfeatures.txt");
function onText() {
/*
= Features_lv.safetyFeatures;
*/;
myTextBox1.text = Features_lv.name1;
myTextBox2.text = Features_lv.name2;
myTextBox3.text = Features_lv.name3;
}
This works fine, but I want it to this for maybe 100 times or more. It is better to let a loop do it in runtime…
Loop one; myTextBox1.text = Features_lv.name1
Loop two; myTextBox2.text = Features_lv.name2
Loop three; myTextBox3.text = Features_lv.name3
…
So if we go back to the action-scripts…
Features_lv = new LoadVars();
Features_lv.onLoad = onText;
Features_lv.load("myText.txt"); //Features_lv.load("safetyfeatures.txt");
function onText() {
/*
Features_lv.safetyFeatures;
myTextBox1.text = Features_lv.name1;
myTextBox2.text = Features_lv.name2;
myTextBox3.text = Features_lv.name3;
*/
For (i=0; i<=100; i++) {
// ‘instanceName’+i.text = ‘loadvariable.formTexfile’+i;
‘myTextBox’+i.text = ‘Features_lv.name’+I;
…
}
}
So my question is how can I write to let flashMx understand my ‘for - loop’, to use instance name dynamically in run-time.
/Stenberg
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.
Dynamically Giving Mc Symbols Instance Names
I'm using the duplicateSymbol, function to duplicate symbols in a loop, I was wondering if there was a way to give each of these duplicated mc symbols a unique instance name or at least the textboxes within them. Basically within these duped symbols I have a dynamic textbox which acts as a label, each duped instance of the mc will have a different text box label and a button which needs to be passed a path variable to its onlick function. My understading of textboxes is that I have to declare the variable it should be recieving, and in the case of multiple textboxes this should be unique. So how do I give each of the duped mc symbols and their respective text boxes uniques instance / variable names?
Playing A Dynamically Created Movieclip Instance(name)?
Hello,
Im new to actionscript, so forgive me if this is a dumb question, but Im trying to do something like this, i have 10 instances named myClip1, myClip2, etc....
code:
for(i=0; i<10; i++)
{
instanceName = "MyClip"+i;
instanceName.play();
}
is this not possible?
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
Dynamically Changing Text Via Instance Name Of A Button
Hi
Im trying to change the dynamic text box depending on what button is rolled over. Since i will have over 100 buttons, i didnt want to have to repeat a lot of code.
if i have:
Code:
on (rollOver) {
lot_number = lot_number1;
}
it works fine (lot_number1 is the instance of the button)
however
this does not work
Code:
on (rollOver) {
lot_number = this._name;
}
even though the instance name is lot_number1 the instance name does not get assigned to the variable.
Please help!!!
Thanks
[F8] Dynamically Changing Text Via Instance Name Of A Button
Hi
Im trying to change the dynamic text box depending on what button is rolled over. Since i will have over 100 buttons, i didnt want to have to repeat a lot of code.
if i have:
Code:
on (rollOver) {
lot_number = lot_number1;
}
it works fine (lot_number1 is the instance of the button)
however
this does not work
Code:
on (rollOver) {
lot_number = this._name;
}
even though the instance name is lot_number1 the instance name does not get assigned to the variable.
Please help!!!
Thanks
'new' Keyword To Dynamically Create An Object Instance
Hi,
I was just wondering if the following is possible. Can I dynamically create new instances by passing in the type of object I want to create:
Consider the following pseudocode:
Code:
var typeOfThing:String = figureOutWhatToCreate();
// 'newThing' is the superclass of the typeOfThing I am trying to instantiate.
var newThing:[superclass] = new [typeOfThing] (param1, param2...);
Or, does the parameter after new need to be a class object ? I know that the above code doesn't work because I've tried it, but I guess I'm asking of it is possible through other means.
I just have a huge switch statement that I am trying to do away with. If this is a totally stupid question, just tell me to forget it altogether and keep the switch.
Thanks in advance,
How Could We Change The Color Of The Symbol Dynamically Not The Instance
hi guys,
i need to change the color of the Symbol(movieclip), Dynamically
i dont want to change the instances color directly...
Let me explain in details
I have a symbol name ball..its color is blue
i have around 10 instances with 10 name on the maintime line
what i need now is if i want to change the color of the symbol...so that all the instances get changed. this should happen dynamically by AS in the symbol only...
Regards,
Mohan.
How To Find Out The Movieclip Instance Name When Added Dynamically
I have created a movieclip with a text box and used that movieclip to add dynamically using the Action script.
According to the number of nodes present in the XML, i am adding the movieclip one by one. I need to know the movieclip name which is clicked. Is there any way to find out that. I have used _name but it is returning the last movieclip name which is added (itemClip3). I need the exact movieclip name which is clicked.
I have pasted the code below. anyone pls help me.
ACTION SCRIPT
--------------
menuXml = new XML();
menuXml.ignoreWhite = true;
menuXml.onLoad = function(success) {
if (success) {
menuItem = this.firstChild.childNodes;
for (var i = 0; i<menuItem.length; i++) {
item = _root.attachMovie("itemClip", "itemClip"+i, i);
item._x = 100;
item._y = 30*i;
item.itemLabel.text = menuItem[i].attributes.name;
item.myUrl = menuItem[i].attributes.url;
item.onRelease = function() {
/:name = item._ymouse;
for(var j=0; j<menuItem.length; j++) {
var strItemName = "";
strItemName = "_root.itemClip" + j;
eval(strItemName).removeMovieClip();
}
gotoAndPlay(144);
};
}
}
};
menuXml.load("xml/projects.xml");
XML FILE
---------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE projects SYSTEM "Projects.dtd">
<projects>
<project name="test1" folder="test1">
<menufilename>mnustars.xml</menufilename>
<templatename>template_stars.xml</templatename>
</project>
<project name="test2" folder="test2">
<menufilename>mnucrm.xml</menufilename>
<templatename>template2.xml</templatename>
</project>
</projects>
Instance Name And Dynamically Created Objects On Screen
Via ActionScript, I created three MovieClips on the screen and gave them names item1, item2, and item3. How do I now get the x and y coordinates (or any other property) of these objects? For example, simply trace(item1.x) does not seem to work.
I have read other posts on this topic and I still don't get it.
Attach Code
var sodaArray:Array = ["Coke", "Pepsi", "Sprite"];
for (var i:int; i < sodaArray.length; i++) {
var container:MovieClip = new MovieClip;
var soda:TextField = new TextField();
stage.addChild(container);
container.addChild(soda);
soda.text = sodaArray[i];
soda.selectable = false;
container.name="item" + i;
container.y= 27*i +50;
DisplayObjectContainer(stage).addChild(container);
container.addEventListener(MouseEvent.MOUSE_DOWN,startDragging);
container.addEventListener(MouseEvent.MOUSE_UP,stopDragging);
}
function startDragging(event:MouseEvent):void {
event.currentTarget.startDrag();
}
function stopDragging(event:MouseEvent):void {
event.currentTarget.stopDrag();
}
// after I move some MovieClips around I want to get the new x and y coordinates.
for (var i:int; i < sodaArray.length; i++)
trace("item" + i .x, y);
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.
AS2.0 Dynamically Load Jpg Into MovieClip As Class Instance
I'm working on a photo-sharing demo using AS2.0, and I have a question that I would very much appreciate help with. I would like to dynamically load photos (stored as jpgs in the .fla's local directory) into MovieClips, and apply a class instance to them. Currently, for debugging, I've imported jpgs to the Stage, converted them to MovieClips, and then accessed their linkage properties, setting them to the class I need them to implement. But for the final application all of this will have to be done with code.
I know how to dynamically load the jpg into a MovieClip using loadImage(), and I know how to create a MovieClip that is an instance of a class by using attachMovie() with a library symbol and the class name. How do I combine the two? Is there a way to access the linkage properties of a MovieClip dynamically?
Thanks!
Want Opening Movie Clip Instance To Close Underlying Movie Clip Instance
Just so you all know, I'm one of three people in our company that uses Flash and I'm considered "the expert". However, we don't do more than a few Flash projects a year, so my scripting knowledge is very, very green. Thanks in advance for your patience.
I have 22 buttons that play an assigned movie clip from the library. I suspect I'm building these things the wrong way (probably true), but here is how each button is constructed....
Each instance that I'm calling a button is actually identified as a movie clip intance with a button in it. It sits on its own layer. When I double-click an instance, several layers are displayed, the majority of which belong to the presentation of the movie clip. The clip lasts five frames.
The first frame consists of blank keyframes for each layer except for one layer that has stop() assigned to the frame and another layer with the actual button. The layer with stop() at frame 1 is then blank for the next three frames, and then another stop() on frame 5 (the last frame).
The button layer lasts all five frames. Here's the script for "display1980":
on (rollOver) {
_root.display1981.gotoandstop(1);
_root.display1982.gotoandstop(1);
_root.display1983.gotoandstop(1);
.
.
.
_root.display2003.gotoandstop(1);
_root.display2004.gotoandstop(1);
_root.display2005.gotoandstop(1);}
on (release) {
_root.Play();
play();
}
For each instance, there is no line of script that refers to itself. In this example for display1980, "_root.display1980.gotoandstop(1);" is not used.
As I mentioned earlier, each instance is on the main stage on its own layer. I've done this with only eight of my instances, so there are now eight layers. (There are--in fact--more than eight layers, but those are not part of this issue.)
The script I created does the job of getting rid of any previously displayed movie clip, but I created a new conumdrum: If I rollover any other button, the currently displayed clip closes. I've tried replacing "on (rollOver)" with "on (press)" but that doesn't work.
Like I said, I suspect I'm buildng this wrong. Is what I built a waste of time, or can it be salvaged? Or, is there a much better and efficient way (and I suppose there is) that can be described so that my green experience can absorb to good effect?
|