ActionScript 3.0 :: Movie Clip Variable - Getting The Error : 1118?
Jun 30, 2009
having a small problem trying to build a simple little Menu Bar.I'm trying to make it so that if I click on one button (Movie Clip) it will make it look different, and then if I click on a DIFferent button (Movie Clip) it will make the old one normal, and the new one look like it is selected.I tried doing so by creating a function that checked what page I'm currently in, and changed the look of the MCs accordingly, but when I run it, I keep getting the following error:
1118: Implicit coercion of a value with static type Object to a possibly unrelated type flash.display:MovieClip.
The line it's pissed about is right before the "if" statement where I say
nextPage = e.currentTarget;
Code:
var startHeight:Number = home_mc.btnBG_mc.height;
var startWidth:Number = home_mc.btnBG_mc.width;
var startAlpha:Number = home_mc.btnBG_mc.alpha;[code]....
View 3 Replies
Similar Posts:
Feb 23, 2011
I have about 85 movie clips on stage and they all have startDrag with MOUSE_DOWN.
here is the thing I need the active one to come forward to the top of all others.
I tried using:
setChildIndex(e.currentTarget, 85)
on the mouse over function but its not working its giving me an error
1118: Implicit coercion of a value with static type Object to a possibly unrelated type flash.display:DisplayObject.
View 2 Replies
Mar 15, 2011
I have this multiple button situation that I just threaded about. Kglad was nice enough to supply me with the proper condition syntax to fix the problem I was having.But now I'm stuck with an 11118 Implicit Coersion Error. I think it's a problem where the movieclip type and event type are colliding are assigned the wrong way or not defined properly further up beyond the code that I submitted.[code]The bold area isthe part that's causing the error. I thought it might be a nested movieclip problem, but deleting all the parenting didn't change anything.
View 2 Replies
Jul 1, 2011
I'm getting this compiler error if I have my member variable directly referencing an existing instance in the same class/container. What I meant is that I can't have "private var movie:MovieClip" in my class to auto link to an existing movieclip of the same name in the same container.I used to do this in AS2 all the time. Is there a way to do this in AS3 instead changing the variable in my class and then do a m_movie = getChildByName("movie")
View 1 Replies
Feb 26, 2012
I get this error when compiling an AS3/Flex project: Error 1118: Implicit coercion of a value with static type Object to a possibly unrelated type HRPeople I've clearly declared dataHR_A to be of class HRPeople, and I've initialized all of the arrays inside the HRPeople.as file. Not sure why I'm getting this error.
[Code]...
View 1 Replies
Jun 8, 2002
i've tried placing the code in the actions pnel of the mc; on the mc at the main time line and in various other unspeakable places... but i always get the same error warning me that this code can only be used in movieclip instances and that my stupidity levels are reaching dangerous levels. (error: 'Symbol=stage_mc, Layer=actions, Frame=1: Line 5: Clip events are permitted only for movie clip instances
onClipEvent(enterFrame){'
i fear somebody will reply to this with:'the code goes on the movieclip instance'...at which point i will take up a career in knitting (i knew i shouldn't have given up the course in the first place)
View 12 Replies
Jul 1, 2009
In my project are pages of text with each word having a button that when pressed will display a movieclip presentation about that word (its pronounciation and spelling etc..). In the project I am working on now I have over 450 unique presentations of words to deal with. I don't want to have all of these hundreds of movie clips on the stage and tell them one at a time to stop and rewind and then have one play each time a word button is pressed. That seems to be very inefficient to me.
add movieclips to the stage using addChild(movieclipname) and remove them using removeChild(movieclipname) but there is a problem. I have hundreds of unique movieclips and I don't want to have to manage hundreds of variables containing the indivudual movieclip instancess. It is a real pain having to figure out what instance is still on the stage before i delete it.In Adobe Director all I have to do is this:
View 5 Replies
Jun 5, 2009
I have this code, and in the end, where I am trying to removeChild(ball) I get an error:
[Code]...
View 2 Replies
Oct 30, 2010
On frame 1 of the main timeline I have a movieclip. The 1st frame of the movieclip stops, and requests a password. When the password is correct, the movie clip plays and stops again on frame 2 - where the user enters their name. I've named this variable 'name_txt', and the submit button will only continue if the variable is defined.
The problem comes when I try to get a dynamic text box in the main timeline to show the user's name - it just stays blank even through i've experimented setting the var / instance names to 'name_txt'. I think I have to set the variable to global or something, but cant seem to get it to work.
View 7 Replies
Mar 19, 2004
I am trying to duplicate a move clip and then set some of it's properties with actionscript. What's the notation to do this?
Here is my guess:
Code:
duplicateMovieClip(_root.event, ("event"+i), i);
[event+i]._y = ([event-i]._y)+([event+i].height);
[_root.event+i].eDate = ("4/2"+i);
[Code].....
View 4 Replies
Aug 30, 2009
I've got a simple ActionScript 1 FLA. The SWF will take incoming variables from SWFObject. e.g. txtVar01, txtVar02, txtVar03 On the first keyframe on the main stage, I have a dynamic textfield, whose 'Variable' name is 'txtVar01'. When I view the SWF in a web page, via SWFObject, the value in the textfield matches that taken from the SWFObject variable. BUT - I have a MoveClip in the FLA, which has 2 other dynamic textfields, called txtVar02 and txtVar03.
When I view the SWF in the web page, these are empty, even though variables are being passed via SWFObject. I guess because the dynamic textfields are within an MC and not on the main stage, they can't access the variable names. I tried adding this to the first frame on the stage:
[Code]....
View 2 Replies
Jun 2, 2009
I have been using this line of code to fade in a movie clip:
new Tween(background_mc, "_alpha", None.easeNone, 0, 100, .5, true);
Now, I want to accomplish the same thing, only this time by using an element from an array (bg_array[currentSlideNumber]) that stores the instance name "background_mc"
I've tried the following, but it doesn't work:
new Tween(bg_array[currentSlideNumber], "_alpha", None.easeNone, 0, 100, .5, true);
View 3 Replies
Jul 29, 2010
I found this tutorial which seems to do exactly what I'm trying to do (the only one I've found to date), except his technique doesn't seem to work for me at all. It doesn't really seem to say anywhere which version of Actionscript he uses, but at least it seems to show that what I'm trying to do is possible for someone, which is a start.I'm trying to do exactly what he describes--I have several squares on a grid that are numbered, eg.grid_0101, grid_0102, grid_0103, and so on, for about 100 squares altogether, and I want to be able to target a given square dynamically.This is the basis of the code I started with:
Code:
var digsquare_x:String = "01";
var digsquare_y:String = "03";
[code]......
View 2 Replies
Jan 21, 2010
I've been animating with flash for a while but I've recently wanted to get into game programing. I've learned a lot in the past month and I'm trying to create a fairly simple point and click adventure game with some basic stats and scoring. I'm facing a somewhat simple problem and I'm not sure how to get it to work in AS 3.0.
At the beginning of the flash I've established my variables to keep score while exploring the game.
var Health:Number = 1000;
var Day:Number = 1;
var EXP:Number = 0;
var Money:Number = 1000;
What I'm trying to do though is set up a movie clip with menu options that, when clicked, brings up a screen that displays those stats as well as a couple extra menu options. What I can't figure out to do is how do I display those variable inside the movie clip.
When I create a dynamic text field and place "info_day.text = String(Day);" i get an error unless I create a variable within that movie clip. And when I do that the variables in the movie clip are not affected by the chances of the variables in the main flash.
how do I have the variable in the movie clip to accurately display the variables established in the main part of the flash?
View 4 Replies
Sep 21, 2010
i am doing a photo album type site where all photos (which are movie clips) appear small and when clicked they enlarge. when the enlarged photos are clicked the movie clip continues and they go small again.
as you'll see from the code below i am doing this by basically saying if the photo is small, play the movie clip from frame 2 which enlarges it until a stop value at 30, and then change the variable value. if the photo is large and then it is clicked play the movie clip from 31 to a stop action at the end and then change the variable value.
everything is working fine except i am not receiving the initial value of the variable "picbtn_position" which is set on the main timeline to value "mainscreen". can anyone help me as to what is going wrong here? maybe i have to do something else to get a variable value from the main timeline to the mc.
here is the code on my movie clip:
on (release) {
if (picbtn_position == "mainscreen") {
trace(picbtn_position);
gotoAndPlay(2);
[Code]....
and here is the code on my main timeline for the initial variable value:
var picbtn_position:String = "mainscreen";
View 3 Replies
Aug 4, 2011
I want to use a variable in my movie clip code. Right now I generate a random U.S. state name and assign it to "correctAnswer". Then I want to assign that to myMovieClip.correctAnswer.gotoAndStop("down"); The problem is that the variable is not recognized and is seen as correctAnswer instead of the U.S. state that was assigned to it. My code is below.
ActionScript Code:
// Correct answer is randomly generated and can be any U.S. state name
correctAnswer = "utah";
// Using the variable correctAnswer this should come out as myMovieClip.utah.gotoAndStop("down");
myMovieClip.correctAnswer.gotoAndStop("down");
View 2 Replies
Dec 3, 2002
I want to cycle through several movie clips for a training application. I plan to use an array to hold the clip names, and a variable (CurrentClip) to set visibility and allow me to use a single pause/ play button throughout. For the visibility, I've found that...
CurrentClip._visible = false; does NOT work. But... setProperty (CurrentClip, _visible, false); does work.
View 2 Replies
Dec 17, 2005
how to refer to a movieclip's name through a variable.If I set root variable "currentMovie = bigRed_mc;", how can I use that variable name to instruct the movie to address the movie clip name stored in said variable?
for instance "_root.currentMovie.gotoAndPlay("destroy");" wouldn't work because it would simply look for that movie clip name and come up empty.I thought "_root[currentMovie]gotoAndPlay("destroy"); would work, with or without parenthesis, but it comes up with syntax errors either way. Can you use a variable to store and refer to a movie clip name and it's properties?
View 3 Replies
Jul 24, 2008
In AS2 I used to be able to reference a movie clip using a variable like this: Code: var target = nameofmovieclip; I've been looking for an answer on how to do the same thing AS3 but with no luck. I'm trying to create a dynamic homing missle, but unfortunately everything I've tried just generates errors.
View 6 Replies
Nov 7, 2008
I couldn't find anything with Google on how to do this, so I'm posting it.I have a code on the first frame of a movie clip that goes to and stops at a different frame in the movie clip depending on a variable that was set outside of the movie clip. It doesn't work, and the movie clip just plays through like normal
View 2 Replies
Jun 21, 2011
I have a movie clip that is executing some code. When this code is complete, I want it to change a variable that is defined on the stage (root?). I know how to get the condition part of it, but quite literally: what do I put to change a variable located on the stage from within a movie clip?
View 1 Replies
Apr 2, 2009
I just need to call a variable or function from a movie clip to main timeline. In AS2 I would use something like:
_root.myvar = "Hola";
or
_parent.myfunc(4,2);
But this doesn't works on AC3. I tried to remove the "_" but its the same.
View 2 Replies
Sep 9, 2009
I have a flash file which uses php to manipulate a database and returns a variable (data_xml) of xml formated data from the database. This happens, along with other things, within the parent. Now I have a child movieclip that displays the parsed data but I am having trouble accessing the variable from within the child movieclip. The code related to this is:
var myXML:XML = new XML();var myXML = XML(event.currentTarget.root.data_xml);
and I get the following two errors which point to the second line as the problem:
1151: A conflict exists with definition myXML in namespace internal.
Warning: 3596: Duplicate variable definition.
I have unchecked "Automatically declare stage instances" because I've seen that suggested for the 1151: error, but I still get the same two errors.
View 10 Replies
May 8, 2010
I have been searching for ages and just cant find out how to do this. i have set a boolean variable inside a movieclip and would like something to change outside the movieclip, using an if statement, depending on whether the variable is true or false, but cant find out how to do it anywhere.
View 2 Replies
Feb 29, 2012
(problem 1 is that I cannot call buttonmoce this way!)I am really trying to imporve my code writing and using arrays and for will save me writing this code over and over again Cheers sub
[Code]...
View 11 Replies
Dec 1, 2010
how to add a movie clip to the stage from the library but i'm strugling to do it when the I need to load a movie clip from the library when the name of the movie clip is held in a variable.
for(var i:Number = 0; i < 64; i++)
{
var blueIconS:blueIcon = new blueIcon();
addChild(blueIconS);
[Code]....
The above code works for adding the blueIcon but I have a variable in that loop which tells which icon to load.
sectorsMCs[jewelsIDs[i]]
The above will tell me what MC name to load but how do I load a MC from library by that variable value?
View 1 Replies
May 24, 2011
How to access variable of parent movie clip in child movie clip in Action script 3.0
View 1 Replies
Sep 30, 2011
I'm in class file right now and made a new movie clip using the linkage name
var mc = new ExampleLinkageName();
addChild(mc);
all good, I can see mc on the stage. In the ExampleLinkageName movieclip, I have a variable defined in it (on the physical timeline) called test.
In my class, I try trace(mc.test) and I get null. how I can read that variable?
View 1 Replies
Jan 28, 2009
I have been struggling with what I suppose is a very simple issue: I am importing content into my application via a text file, this all works fine. I have about 10 different movie clips on the parent timeline that I have hidden (dc_mc.visible = false.So what I need to do is take one of the variable names that I've got from my text file and use its value to "turn on" one of these hidden movie clips.So I'm trying stuff like:
var directory = e.target.data.directory; // Grabs the data, sets var
var raceNameButton:String = directory+"_mc"; // Set data into new var
raceNamesButton.visible = true; // display movie clip with var name
[code]........
View 1 Replies
Dec 10, 2009
Is there any way to dynamically name a varaiable or created movie clip? I know that I could make an array of movie clips, but what I really want to do is make a new movie clipe name based on another name. The reason I want to do so is that I want to pass a movie clip to a function and have it make a new movie clip (to contain the first) with a slight variation of the test such as "frame" or "handle" which I can then use to center the source movie clip.
View 1 Replies