ActionScript 3.0 :: Use A Movieclip Path From A Variable?
Oct 6, 2011I have a variable that will change,
and i want to make it my movieclip path, example[code]...
I have a variable that will change,
and i want to make it my movieclip path, example[code]...
using a variable in a path to a MovieClip.
I have a menu with 4 tabs. When I click on one I want it to open and the previous one to close.
I'm storing the previous tab as a variable (_previousTab) but am having trouble adding the variable to the path to the MovieClip of the previous tab. The error Flash gives me is:
TypeError: Error #1010: A term is undefined and has no properties.
at MenuRun/menuOpen()
[Code]....
If I replace mainframe[_previousTab] with the name of the MovieClip it works fine. I'm thinking it's something to do with the variable being a String perhaps?
I'd like some help on using a variable in a path to a MovieClip. I have a menu with 4 tabs. When I click on one I want it to open and the previous one to close.
I'm storing the previous tab as a variable (_previousTab) but am having trouble adding the variable to the path to the MovieClip of the previous tab. The error Flash gives me is:
[Code]...
If I replace the variable _previousTab with the name of the MovieClip it works fine. I'm thinking it's something to do with the variable being a String perhaps?? Also, the trace statements return the desired MovieClip names.
i have a problem adressing or targetting a attached mc when i target de mc directly it works fine but when i try it trough a variable it doesnt recognise its path anymore??? hopefully a part of the code is gonna explain the situation a litle better... this piece works fine:
[Code]...
i have a problem adressing or targetting a attached mc when i target de mc directly it works fine but when i try it trough a variable it doesnt recognise its path anymore???
[Code]...
Here's what i'm trying to do: Hide a MC depending on the path variable as:
[Code]...
Well that doesn't work, for some reason, i can't use a string as a multiple level path..
I have several UIs and wish to automatically load images into the containers. I have repeated the actionscript line, which has created a lot of code.As the lines are similar all but the image number, I am thinking to use a loop and variable to insert the image number into the code. Here is the code:[code]a variable to replace the number between I am not sure how to do the same for the Movie Clip path.Is it possible to use a variable to define the number (2) in this statement?
View 2 Replieswhy I cannot use a variable in a path?
Code:
function buttonControl(buttonNumber){
var buttonClip = eval ("bu"+buttonNumber+"_mc");
this.target_mc.buttonClip.gotoAndStop("active");
}
I can work my way around it, but why doesn't it work?
I'm curious why this doesn't work.
[Code]...
I am trying to create an xml based site navigation that will drill down to an infinite number of xml levels. I have tried to send an xml path as a variable with the currently selected menu item but I doesn't seem to work. Here is my code, it seems as though it should work, but it does not.
View 2 Replieshow to use the variable in a path
[Code]...
The bold below is what I would like to work, however it does not. It might not be able to happen like this at all.
basically on mouse down I take the event.target.name and perform a string manipulation to get the number out of the target and add some string to front and end to get the name of the movieclip I would like to effect. Is it possible to insert the value of dotName into the path?
eventName = event.target.name;
stringManip1 = eventName.substring(13, eventName.indexOf("_")); //get the Number before the _
dotName = "dot" + stringManip1 +"_mc"
[Code].....
Having trouble changing a variable for an object path:Set-up initial path:
Code:
displaySlide="slide1";
Change the path/variable through user action:
[code].....
I have a variable that is refers to the names of folders, and I need to insert the variable into the pathname when I loadMovie. I cannot seem to get the variable to become part of the pathname
loadMovie('VARIABLE/image.jpg', _root.loadhere);
I've tried parenthesis, [], (), do not know the correct way to call the variable.
I want to create a variable that I can call in a path. For instance:
Code:
var myVar = "varHome";
Then, to use in code:
Code:
_root.mcContent.varHome.gotoAndPlay(1);
Can you do that? This way obviously doesn't work (because I've tried it). Is it possible at all?
why I cannot use a variable in a path?
[Code]...
I can work my way around it, but why doesn't it work?
through out a very old complicated fla there are buttons which set variables using _global paths
such as:
function menu1_2(Event:MouseEvent) {
global.mode = "hide_hotbox";
MovieClip(this).gotoAndStop("stage_1_b");
}
How can I make the variable "hide_hotbox" and others like it accessible and changeable from any movie clip -- whether they be nested in other movie clips or on the main timeline, etc?
I need to load an external SWF into a movieclip, and get the name of the SWF from a variable from a class. The variable is called getSWF and is defined as the following in the class
public var getSWF = "movie.swf";
When I trace(getSWF); on the first frame of the main time line it outputs fine. However when I use the following code on the movieclip:
var imageRequest:URLRequest = new URLRequest (getSWF);
var imageLoader:Loader = new Loader();
imageLoader.load(imageRequest);
addChild(imageLoader);
I get the error:
1120: Access of undefined property getSWF.
Is it possible to have a object path changed due to the value of a variable?
eg.?
Code:
ClipNumber = 10
_root.ClipMC.[ClipNumber].Stuff = "This is stuff"
What Im asking is, can a value in a path be equal to that of a variable?
lets say I have a variable like this:
Code:
var pathName = "section2";
Then I have an object called "book". "book" is the parent of other objects named:
section1, section2, section3 and section4.
I want to apply a gotoAndStop() to section2 inside the book object. But instead of typing it the normal way:
[Code].....
Oddly if I use a quoted string, like
loadMovie( "http://www.miniclip.com/games/cube-buster/en/cubebuster.swf" , 1);
it works fine
But if I pass in a variable:
var fullpath:String = "http://www.miniclip.com/games/cube-buster/en/cubebuster.swf"
loadMovie( fullpath , 1);
it fails ???
Can't find anyone else's comments on such an issue.
Using flash 8, as2 on Mac osx
The example above remote domain example works fine within flash IDE
My actual application using a relative path to a sub directory, for a little obfuscation.
So I've created a script where a mc is clicked on and the player can draw a path using the mouse. I'm trying to figure out how I can get the mc to follow the path drawn out by the player's mouse and when the player clicks again, it erases all of the path.my code is below
Code:
import flash.display.Sprite;
import flash.events.MouseEvent;[code].....
I need to feed the path of a target to a function and it needs to rewrite to set a value to it. example below
[Code].....
Basically it works if it's only one target name with no previous/subsequent targets like path1 works but not path1.box is there any way to fix this?
How do i control a movie clip which path is contained in a variable? I.E.: I have a variable called: _root.activeButton The variable has this path as a value: _root.buttons.button1 Q: How do I tell _root.buttons.button1 to go to frame 1? I think it is something like this, but I can't remember exactly: [_root.activeButton].gotoAndStop(1)
View 1 RepliesDoes anyone know whether it would be possible to set a motion path for a movie clip and to have the speed of the tween set as a variable which can be increased or decreased by the user during the movie?
View 3 RepliesOne movie, named Gallery_1, with hotpots via which external swfs are loaded into a container mc of the main timeline of the Gallery_1 movie,
Via another button function the Gallery_1.swf is loaded into a container mc on the timeline of the main swf, which works alright as well, but when one then clicks the hotspots of the Gallery_1.swf one gets following error message:
ReferenceError: Error #1065: Variable GallerySite not defined.
at HotSpot1/PictureLoad()
at HotSpot1/PictureCall()
[code]....
The traces in the eventHandler function work alright.I wildly imported all relevant classes I could think of, e.g. the GallerySite class to the WebSite class and vice versa, and tried various variable definitions, but am at a loss by now as to where to define the GallerySite variable.
I've looked and looked but i cannot find any way of using as3 scipt to make a movieclip follow a path.
View 3 RepliesNow yes i'm getting started to AS3 but I still have a lot of blanks in my mind.For example in as2
ActionScript Code:
trace(this);
// Outputs : _level0.myMc.theContent.instance15.instance36
But in AS3 i'm getting just the ".name". Ex:
[code].....
I have embedded a external swf in a movieclip called "container". In the external swf is a movieclip "black_rectangle". How do I have to write the path to this rectangle? My version doesnt't work and i have no idea why not
[Code]...
I know how to do motion guides, but now I also want to control this movieclip with actionscript code, so that I modify the x and y properties, but STILL restrict the position of the movieclip only to that motion guide. I see that once I modify the x or y properties, the movieclip jumps off the motion guide
View 1 Replies