Actionscript 3.0 :: Call A Movieclip Using The String Class Together With It's Instance Name To Use GotoAndPlay() Method
Sep 20, 2009
I just want to ask if is it possible to call a movieclip using the String Class together with it's instance name to use gotoAndPlay() method. I know how to use the instance name and the method but then what if I want to use a string together with the instance name and the gotoAndPlay.
View 1 Replies
Similar Posts:
Oct 15, 2009
From my Main class, in the method onBackgrLoad, I am trying to call a couple of public methods (i.e. xmlData, hintergrund & numOfProducts) located in LoadXML. I keep receiving an error message that "loadXML" is undefined. I dont understand why because I clearly defined it in the main class:
PHP Code:[code].............
View 2 Replies
Sep 19, 2009
I just want to ask if is it possible to call a movieclip using the String Class together with it's instance name to use gotoAndPlay() method.
I know how to use the instance name and the method but then what if I want to use a string together with the instance name and the gotoAndPlay.
View 4 Replies
Sep 19, 2009
I just want to ask if is it possible to call a movieclip using the String Class together with it's instance name to use gotoAndPlay() method.I know how to use the instance name and the method but then what if I want to use a string together with the instance name and the gotoAndPlay.
View 2 Replies
Jan 26, 2009
I have a general / somewhat newbie question. Is it better practice to call a function from another class like so:
[Code]...
Does one way free up more memory or enhance performance?
View 5 Replies
Nov 2, 2010
I am trying to learn ActionScript 3. I have a MovieClip called Ship in the library and have made class of it called ship. The Ship movieClip glows from Frame 6 to indicate when it crashes into an asteroid.The myShipMovieClip child is controlled by arrow keys and asteroid approaches. The hitTest works but I cant get the ship to glow i.e. from the timeline go to the Ship MovieCli in the library and go to frame 6 to start it to glow. I have managed to do this in ActionScript 2 but have tried for the last few days to try and do it in AS3here is my code :
import flash.events.KeyboardEvent;
import flash.events.Event;
import flash.display.MovieClip;
[code].....
View 3 Replies
Dec 28, 2005
I have a class called Unit. When I use this class in a .fla file, I create it by saying:
var unit00:Unit = new Unit(...);
So then it creates a gfx representation of the screen for me. I would like to have a method like this:
PHP Code:
[code]....
So how do I get this to work? I know that delete this will not work when defined inside the class. How do I target the .fla's instance name when I don't know what it will be called?
View 10 Replies
Jul 29, 2009
I'm getting the following error message when I try to run the AS code below:
1180: Call to a possibly undefined method string.
The error occurs at every instance of:
min = string(min % 60);
I think CS3 doesn't like this "string" format and that it probably different from that of CS2 in which the code was derived from.
this.onEnterFrame = function() {
var todayate = new Date();
var currentYear = today.fullYear();
[Code]....
View 6 Replies
Nov 4, 2010
I have a class, my document class, called SilkRoadTweeter. as I also have a class called User.as In my User class I need to call a method called nonce() I have tried this, trace(SilkRoadTweeter(root).nonce()); But I get the error, TypeError: Error #1009: Cannot access a property or method of a null object reference.
View 4 Replies
Jun 9, 2011
They are located in the same package and are both importing each other. I am trying to call a function from Class2 within Class1, but I don't know the syntax. I tried: Class2.godoThisThingNow(); But it gave me an error 1061, call to an undefined method. What's the proper syntax for this, and is it even possible in AS3?
View 3 Replies
Oct 12, 2009
From my LoadXML class I am trying to call a method, named onBackgrLoad, which sits inside the Main class. I made the method onBackgrLoad public. Inside the LoadXML class in the method ParseData I added an event listener. This is supposed to call onBackgrLoad but it doesnt work
[Code]...
View 3 Replies
Jan 21, 2010
What I want to be able to do:
- click a guy to select him
- click an adjacent tile
- move selected guy to clicked tile
The way I've coded it, each instance of a guy class has a mouse even listener on him which listens for a click. When clicked, I find out the tile underneath him, and the surrounding tiles. So far, so good.
When clicked, the guy calls a method in the tile class, like tile.onClick, which tries to say: get this tile, and send it back to a method in the guy class, like moveGuy. Then moveGuy moves the guy to the tile it was told.
Problem:
From the guy class, I call a method in the tile class. To communicate between classes, the tile class method onClick must be static. But if it's static, the method can't refer to "this", because it's a method in the class only, not on each instance of tile. But I need to know which tile was clicked, and send that reference to the guy so he knows where to go.
How do you access a method from outside its class so that the method can refer to "this" instance? OR, how do I find out which tile was clicked without needing any code on each tile instance? OR... how else can this problem be solved?
View 1 Replies
Jan 21, 2010
What I want to be able to do:
- click a guy to select him
- click an adjacent tile
- move selected guy to clicked tile
The way I've coded it, each instance of a guy class has a mouse even listener on him which listens for a click. When clicked, I find out the tile underneath him, and the surrounding tiles. So far, so good.
When clicked, the guy calls a method in the tile class, like tile.onClick, which tries to say: get this tile, and send it back to a method in the guy class, like moveGuy. Then moveGuy moves the guy to the tile it was told.
Problem: From the guy class, I call a method in the tile class. To communicate between classes, the tile class method onClick must be static. But if it's static, the method can't refer to "this", because it's a method in the class only, not on each instance of tile. But I need to know which tile was clicked, and send that reference to the guy so he knows where to go.
How do you access a method from outside its class so that the method can refer to "this" instance? OR, how do I find out which tile was clicked without needing any code on each tile instance? OR... how else can this problem be solved?
Is this problem what getters & setters are for? I don't really understand how to use them yet.
View 2 Replies
Jul 27, 2009
If all I have is an instance of an object, can I call a static method of its class? For fun, let's say I don't know what the name of the class is, only the name of the static method.
View 3 Replies
May 23, 2011
class Foo {
public function bar():void { ... }
}[code].....
View 4 Replies
Sep 21, 2011
My method has been passed a class instance, but it was typed through an interface so I'm not 100% sure what class it is. I'd like to attempt call a static method on that instance's Class.. is there an easy way to do this without being forced to pass the class along as well?
Something like this:
ActionScript Code:
public function foo(myBarInstance:IBar):void {
var barClassPointer:Class = getClass(myBarInstance);
try {
[Code].....
View 4 Replies
Mar 18, 2010
how can i use getUserID method in my main.as?
NetConnectionClient.as
package com {
import flash.events.EventDispatcher;
import flash.events.Event;
public class NetConnectionClient extends EventDispatcher {
[Code]...
View 6 Replies
Dec 4, 2010
I can call JS functions with ExternalInterface.call('func_name',.args). OK
But what if I would like to call a js class instance method instead?
ExternalInterface.call('obj.method_name',.args) //this seems not to work
Is there any way of doing it?
View 2 Replies
Oct 21, 2009
Lets say I do this in one of my classes[code]...
how could I from _shader call a method in this class (where _shader was instantiated)?
View 6 Replies
Feb 25, 2012
I have this class called Main. And inside this Main class I have a method that I'd like to call from a the main timeline.
So on the main timeline I have instatiate the Main class like this:
var mainClass:Class = flash.utils.getDefinitionByName("Main") as Class;
var main:Sprite = new mainClass(this, mc1_mc, mc2_mc);
addChild(main);
Then on the frame after that, I try to access a function inside that Class like this:
main.prepareGame();
But I get this error:
Scene 1, Layer 'Layer 2', Frame 3, Line 61061: Call to a possibly undefined method prepareGame through a reference with static type flash.display:Sprite.
View 7 Replies
Jul 7, 2009
i have a main movie. i use a loader to load a "example.swf" file. then i place that file inside a holder movieclip. in example.swf, i have an instance of a class i just wrote. this class has some particular methods. from my main movie, i want to call the methods of the instance of my class i have in example.swf. how can i do that??? i know it's a kind of casting, but none seems to work.
View 1 Replies
Apr 27, 2009
When I try to use this code to call a function for every instance of a certain class I get an error saying that there is a "call to a possibly undefined method removeInstance through a reference with static type flash.displayObject".
Code:
for (var i:int=0; i<=numInstances; i++) {
if (numInstances!=0&&getChildByName("b"+i)!=null) {
getChildByName("b"+i).removeInstance();
}
}
View 2 Replies
Jul 15, 2009
I have a pointer to a Class object like so:
var temp_class:Class = getDefinitionByName(getQualifiedClassName(some_obj ect)) as Class;
I want to use it to call a static method 'can build' on that class, like so:
function can_build_ot(c:Class, qualifier:Object):Boolean {
if (c.can_build(this, qualifier)) {return true;}
return false;
}
When I do this, Flash CS4 AS3 tells me
1180: Call to a possibly undefined method can_build.
View 6 Replies
Apr 23, 2010
Can I call a java class method from inside a flash movie?
View 1 Replies
Jul 31, 2010
I have .fla file where I have instantiated an object of a class( testclass.as ) like this in frame 1
[Code]...
View 9 Replies
Jan 30, 2010
For some reason I cant figure this out,I have a function thats in a method in a class..I have a second method in the same class, trying to call the function from the second methodeg:
Code:
package com.sarin
{
[code].....
View 4 Replies
Feb 1, 2009
Is there anyway to include a function or overrite something in a class that'll output a custom string when the object is called as a string?
So for example if I created a class named "myClass" and I instantiated it:
Code:
var myObject : myClass = new myClass();
When I:
Code:
TextControl.text = "blah blah, " + myObject;
myObject is getting casted as a string. Normally it would output:
"blah blah, [object myClass]"
Is there a built-in function that recast the object as string? Is there anyway for me to change that string output? I know I can just make a public toString() method in the class or something, but just wondering if there was something better.
View 3 Replies
Aug 7, 2007
In as simple an example as I can think of, I have two classes: Dog and Cat. Both are subclasses of Animal, in this stupid example... I know how to create instances of both, however I don't know how to dynamically create them by name from a string. It would be something like...
[Code]...
View 14 Replies
Nov 4, 2010
I am trying to write a class that will take a string (provided by a different class) and display it gradually, character by character, as if it were being written by a typewriter. To do this I am making use of the setInterval method in flash.utils, but I'm having difficulties... whenever I test the movie there is no text displayed, but flash isn't reporting any errors.
Here is the code:
package {
import flash.display.MovieClip;
import flash.text.TextField;
import flash.utils.*;
public class TypeWriter extends MovieClip {
[Code] .....
View 1 Replies
Nov 5, 2009
I have a RemoteObject returning a 'Schedule' class. I've created a client side RemoteClass to map to it. All properties of the class instance are coming in fine. I just not clear on how I go about calling methods on the class. How would I call a setter on startdate?
package classes.remote {
[Bindable]
[RemoteClass(alias="com.site.data.schedule.Schedule")]
public class Schedule {
public var id:int;
public var modifydate:Date;
public var startdate:Date;
public var enddate:Date;
}}
View 2 Replies