IDE :: Passing Instance Names To A Function Turns Up Error Message?
Feb 24, 2010
I made this function,that is supposed to create a bunch of slides based on a parameter. That parameter should be the instance name:
Code:
function createSlide(instName:Object){
trace(instName);
this.createEmptyMovieClip(instName, this.getNextHighestDepth());[code]....
In the script I call the function with
Code:
createSlide("mySlide");
After execution, this error message appears: Error: A 'with' action failed because the specified object did not exist.The trace statement returns the instance name -"mySlide"- When I replace instName with a stringtype name like "mySlide", it works fine.But I don't want that 'cause in that case I have to write a specific function for each slide.
View 2 Replies
Similar Posts:
Jun 30, 2010
How do you pass instance names into arrays? I've got a bunch of movieClips of states.
They all have instance names.. alabama, arkansas, delaware, florida, georiga, etc..
I am trying to send them all to an array because I need to be able to disable the movieClips all at once and I don't want to call each one separately. I setup an array and a "for" loop, and it properly gets each value in the array:
ActionScript Code:
states = new Array(alabama, arkansas, delware, florida, georgia);
stateslength = states.length;
[Code].....
View 9 Replies
Oct 8, 2009
#1006: value is not a function. at MethodInfo-43() I don't know what the problem is, or where could it be, here is the problem code, but first a brief description: Every 3 seconds 3 enemies will be created with a random position, the enemies can't be appearing on top of the other so I check if they collide with any previously added enemies, if they do I assign other random coordinates and check again until there is no collision (I'm using the collision detection kit CDK for the collisions[URL]..the first 3 enemies appear correctly but afterwards the error appears and the next time the program enters the generation part the enemies begin appearing in ridiculous numbers.
[Code]...
View 1 Replies
Mar 15, 2012
i am new to flash (yet i have been using it for years) by that i mean, i struggle with it a lot. i was hoping someone could help me with the "incompatible override" error message and the "duplicate function definition" message.
[Code]...
View 3 Replies
Sep 29, 2010
Well I want to set up a function that will calculate the x position of where my MovieClip's instance name will go. Here is the code i currently have.
function xBtnPosition(btnName: String, btnXpercentage: Number):String
{
var xFinalPosition: String = -(((btnName.width * btnXpercentage) / btnName.scaleY));
[code].....
View 3 Replies
Apr 24, 2006
k the idea is that this movie keeps tracks of whatever page it's on using the variable current. when the button evolution is clicked it should jump to frame 2 of the movie whose instance name is contained in the variable current and also pass this variable to a function called alpha which fade that movie's instance when moving to another page - then that page's name will be assigned to current.
this is the code that i have now..
#include "alpha.as"
evolution.onRelease = function() {
this[current].gotoAndPlay(2);
this[current].alpha(5, 0);
};
all these buttons and movie instances are contained in the same movie clip and the variable current is declared in it too.
View 1 Replies
Feb 20, 2012
I'm trying to define this function so I can pass the CardButtons sprite to the Add Cards function. It "works" but there's one problem: the CardButtons sprite used in the function is determined by the value of i at the time of the function call (or in other words, the value of i when I click the sprite).
I want the sprite passed to be literally the value of CardButtons[i] at the point when the function was defined.
CardButtons[i].addEventListener(MouseEvent.CLICK, CardFunctions[i]= function(){ AddCards(CardButtons[i],PlayerHand[player-1][PlayerHand[player-1].len gth-1]);});
Is there a way I can do this, or is there a better way to do what I'm trying to do?
I guess for further example:
I want CardFunction[0] to store the AddCards function with the value of CardButtons[0] passed, it should NOT be dependent on the value of i.
View 3 Replies
Aug 30, 2011
I have inherited a website maintenance project that has a Flash rotating image banner.I have managed to get the images to fade-in and fade-out correctly, but now I need to make these images clickable - linking images to pages in the website.I have read many posts here and have reviewed the video tutorials. I have been able to get the first image clickable using this AS3 action:
mars_btn.addEventListener(MouseEvent.CLICK, buttonClickHandler);function buttonClickHandler(event:MouseEvent) :void { navigateToURL(new URLRequest("http://somewebsite/mars.php")); trace("I'm clicked"); }
[code].....
View 2 Replies
Mar 20, 2011
I started a thread about a reference to a symbol House, in the output window, which was: House_1. A lot of people said some useful things about that. All day I've been thinking about it, and I came to the conclusion that I don't understand things, at a very basic level.
Consider:I make a movieclip which I give the Symbol name Drawer. (I don't export it for AcitonScript.)On the stage I manually place two instances of this Symbol. The first one I give the Instance Name drawer (in the properties panel). The second one I leave nameless.Now if I trace the names of both these clips, by
trace(this.getChildAt(0).name);
trace(this.getChildAt(1).name);
the output window gives me
drawer
instance2
Now I know that the so-called "instance name" which I gave in the Properties Panel (drawer) is, in reality, a variable name which Flash gives my first instance behind the scenes. And instance2 is a name that Flash gives my second instance. What exactly the nature of that name is, I do not know.My point is: both names (drawer and instance2) are the .name property of these movieclips. Otherwise I could not have traced them through asking for the .name property, in the above. Yet only the first of these two can be manipulated:
drawer.x can be set;
instance2.x can (as we know) not be set.
But...why? What is the real difference between these two kinds of names? How can they both be the .name property of their underlying movieclip, yet be of such a different nature? What IS the nature of the instance2 name? If it's a String, how come the .name property of one movieclip can be a variable name, while the .name property of another (but identical) movieclip is a String?
I've searched every bit of web page on the net I could find. But it looks as if nobody addresses this issue. We all just work with it - but it makes no bloody sense. A name property = a name property, you'd think. Whether Flash set it or I set it should not make a difference. The x property of a clip, for example, does not change in nature according to who set it - me or Flash.So, again, just to emphasize the problem: how can a property (the name property) of a movieclip change in NATURE depending on who set it? After it's been set, shouldn't the name property of a clip be of exactly the same nature as the name property of another clip?
View 8 Replies
Apr 9, 2010
It seems that with as3, the error compiler is just waiting to get you.I have a function that loads in an external swf. Which swf depends on which button they click. So, it could be pic1.swf, pic2.swf, pic3.swf, etc.
function loadMovie(){
my_mc.addChild(my_Loader);
addChild(my_mc);[code].........
When i test, I get "error: access to undefined property myVariable.
View 2 Replies
Sep 22, 2010
I have a actionscript 3 based desktop Flash app which has its own event model(GUI component) and another native c++ application(business logic) which has its own model. I want to connect them and have a middleware module which can act like an arbiter between the two and dispatch events across the two components according to some model logic required for my domain specific app.
View 1 Replies
Dec 24, 2011
I am trying to and I have the following message error:"the video player is in the connection error state. It enters this state when a video stream attempted to load but was unsuccessful. There are two possible reasons for the error: no connection to the server or the stream was not found."
View 1 Replies
Dec 4, 2009
I've created some error handling for external images loaded via a path in XML. Within the Flash preview it's fine and shows the full error message (and most importantly, the URL that isn't loading).
But in the browser, even locally, it doesn't out put this message!
Here's my code:
function loadIOError(event:IOErrorEvent){
errorLog+=event.text+'
';
}
[Code]....
View 2 Replies
Jul 7, 2010
i am currently trying to learn ZendAMF, but i have a hard time troubleshooting which makes learning it quite hard. Is there a way to make the PHP file throw an exception that gets traced as an error message in AS3 (not Flex), the only error i seem to be able to get is "Error #2044: Unhandled NetStatusEvent:. level=error, code=NetConnection.Call.Failed", but it tells me jack ****.
i have gotten ZendAMF working, i just want to know how i can make error handling better, so that as an example can use PHP to tell flash that no results were found, or that the typed text was invalid. Is it better to use AS3 to check if the field was filled properly?
View 1 Replies
Mar 17, 2010
I have a grid 8 columns, 3 rows.I used instance names such as 1-1, 1-2, 2-1, 2-2, ect to easily identify each cell. I can call the movieclips within them without a problem by doing this["1-1"].gotoAndPlay(1); but how do I go about calling them when I can't use "this"? "1-1".gotoAndPlay(1); does not work.
View 2 Replies
Jan 26, 2009
In the first frame I have 60 buttons with each having a actionscript in it using the instance name "A1". What I need to know is how can I REPLACE the instance name from A1 to B1 in 60 buttons in my NEXT FREAME?
Is there an easy way to do it rather than typing one by one?? I used the "FIND AND REPLACE" option but it replaces A1 to B1 in both the frames. I need to alter the instance name only in the second frame. How can I do it?
View 3 Replies
Apr 26, 2009
I have two buttons, they're both movie clips, and have identical code except for their names. When I place one of each on the stage and give them instance names, they come up output:
[Code]...
View 1 Replies
Sep 14, 2010
How to write the following AS codes using VAR instead of instance names?
my_Input_Txt.onChanged = function() { _root.my_Dyn_Txt5.text = my_Input_Txt.text;_root.my_Dyn_Txt6.text = my_Input_Txt.text;};
_root.my_Dyn_Txt5._visible = false_root.my_Dyn_Txt6._visible = false_root.MDT1._visible =
[code]....
View 7 Replies
Nov 4, 2009
I have a flex application that reads from external XML file(URL loader) and displays graph. My xml file is dynamically generated using PHP and the filename=currentloggedin user name(i.e. username.xml).How should I load the xml into SWC? Will Flashvars work? I have a HTML page that has PHP code to get username and the same file embes the swc. How to pass the PHP varibale to my SWC?
View 0 Replies
Jun 5, 2011
I am working on a project where I have on the stage 8 movie clips, and when hovered, they are to shake. I have made this into a class, and placed the code as an external .as file.
Each movie clip is named shaker_mc - shaker_mc7
I have also gone in and changed all of the button movie clips base classes to ShakeButton.
Right now I am getting a couple of errors, and I believe all i need to do is pass the buttons names to the class in the external .as file, but I am not sure how to do that? I had everything working without the external script, but I did not want to have to create the effect for each button.
The erros are:
1120: Access of undefined property shaker_mc.
Here is my code for the ShakeButton.as file
ActionScript Code:
package{
import flash.display.Sprite;
import flash.events.MouseEvent;
[Code]......
View 3 Replies
Sep 24, 2008
Is it possible to pass variable as arguments for a function? I wish to update a boolean variable via a function, by passing the name of the variable to the function, like so:
Code:
function ENVSegment(curSegment:Boolean, nextSegment:Boolean) {
curSegment = false;
nextSegment = true;
} var attackSegmentIsRunning:Boolean = false;
var releaseSegmentIsRunning:Boolean = false;
[Code] .....
Much shorter, and easier to understand. Also, less repetition of the same blocks of code over and over...
View 1 Replies
Jul 15, 2009
I get the error "Access of undefined property menu_bar" when menu_bar is an instance name directly on the main timeline. I'm not sure how I would call it in the other class. It also isn't exported for actionscript is that the problem?
I have it imported to my document class as:
var mouseClicks:MouseClicks = new MouseClicks();
addChild(mouseClicks);
Then the class looks like this:
Code:
package{
import flash.display.MovieClip;
import flash.events.*;
[Code]....
View 2 Replies
Mar 4, 2010
I know I've read something about this here before but I can't find it, so for Mr. Thicky here, I have dragged some buttons on my stage - each one is actually an instance of the same movieclip. In the IDE, I have given them instance names like 'myButton1', 'myButton2' etc. I've then grouped all these buttons together into a single container movieclip called 'buttonHolder'. Now, in my code, I am trying to retrieve the instance name of the button I have clicked on:
[Code].....
View 3 Replies
Jun 3, 2010
I have 100+ of the same movieclips on the stage at the same time, all positioned differently.i'm getting really tired of clicking on one of them, then clicking in the instance name box then typing "i65", then clicking on one of them, then clicking in the instance name box then typing "i66"...
is there anyway flash can fill this information in for you? or a plugin anyone's heard of? this isn't really an actionscript question, I'm not so fussed about selecting the different movieclips based on getChildAt or any of that stuff, I'd just really like a faster way of assigning instance names.
View 1 Replies
Oct 22, 2010
I have a 4x4 set of square buttons that I need to give instance names to. They will be named 'btn_1' thru 'btn_16'. Is there any shortcut to assigning the names or do I have to go through 16 times clicking on the button and clicking down to the 'instance name' text box?
View 2 Replies
Oct 4, 2011
I am working on making a photo flip animation between 5-7 photos but i have to duplicate this 70 different times. So what i have done is made a scene for each set of 5-7 photos, they are externally being pulled in through an AS3 script to prevent a large .swf file from happening with all those photos. The problem i am running into so that i cant seem to run a find and replace search to replace the instance name values.
View 1 Replies
Feb 3, 2009
iv got these buttons animated using the inbuilt tween function and am coding them like this:
function navOver(e:MouseEvent):void {
var page = MovieClip(e.currentTarget).buttonThumb;
var myTween16:Tween = new Tween(page, "y", Regular.easeOut,
0, -25, 0.35, true);
[code]....
MovieClip(e.currentTarget).instanceName returns undefined neather of which are the instance name.i cant hardcode the function because its used on lots of different mcs throughtout the flash file
View 4 Replies
Feb 23, 2010
I am trying to get the instance name that i gave to a dynamically created movieclip the movieclip was created using var zebra_mc:Zebra = new Zebra(); //creating a new instance of the zebra class The movieclip was then added to the stage using a for loop, as it was contained in an array. Each time a movieclip is added to the stage it is then added to another array (existingObjects) I then need to iterate through this array and pull out each objects names. I have tried using existingObjects[i].name, which returns "instance140" and existingObjects[i].toString, which returns functionFunction(){}, very useful. and existingObjects[i] which just returns the object.
View 2 Replies
Jun 18, 2010
I know its possible to hit test From something without an instance name if you have it in a seperate .as file. All you have to do is type in this.hitTest(InstanceName);
But, Is it possible to do a hit test from something without an instance name against something else that doesn't have an instance name?[code]...
View 16 Replies
May 30, 2011
I know you can store instance names in an array and call on the array values to reference the instance names in it.I was wondering if there is any way I can take an instance name, feed it directly into a function and use the name of the function variable/array/whatever to affect the object instance of whatever I name.
if it's an array of instance names, what is it actually an array of? Also, is there any way to hold and reference an instance name in a single value? sidenote: this doesnt have much to do with my question, but can arrays be fed directly into the header of a function?
View 6 Replies