ActionScript 2.0 :: [FMX04] Calling Function On Movieclip From Class Method?

Sep 15, 2007

Is it possible to call a function defined in a movie clip from a class?Here's a sample project setup I'm trying to achieve this simple feat:

func.fla
- Has one movieclip "fooinst" which is library item "foo".
- The "foo" library item has linkage is to the "Foo" class
- The "foo" library item has one script on it's first frame:

[code]....

View 2 Replies


Similar Posts:


ActionScript 3.0 :: Calling A Function From Method In Class?

Jan 28, 2009

I create an instance of an object - This is on my main.fla

ActionScript Code:
var newClass:MovieClip = new myClass;
newClass.myFunction();[code]....

I've tried putting parent. before it etc - just to note this isnt my actual code I'm working on but a simplified version of it.

View 7 Replies

Actionscript 3 :: Calling A Method, Which Is Defined In Another Class, From Main Class Gives Error 1120?

Aug 16, 2010

I have two classes. The Main class calls a function, which is defined in a Second class.I'm getting the following error:Error 1120: Access of undefined property myFunctionBasically, I am creating buttons in the Main class that will add a corresponding Child to an Object in the Second class (if you click one button, child x1 will be added, if you click another button, child x2 will be added, and so forth).Here's the relevant code for the Main.as file:

package
{
import flash.display.MovieClip;

[code].....

View 3 Replies

ActionScript 3.0 :: Calling Method In Parent Class From Imported Class?

Jul 15, 2011

I have the following parent class that I'm working with:

Code:
package {
import com.poptent.SubClassOne;
import com.poptent.SubClassTwo;

[Code].....

I am trying to set it up so that a parent method called by subClassOneInstance can affect subClassTwoInstance.

View 4 Replies

ActionScript 3.0 :: Flash - Calling Method On Document Class From Another Class?

Jul 5, 2010

I have a rather silly question but as3's document class always gets me confused.I have a public method on my document class. I want to call this method from another class that is instantiated from within an object in the library of the flash file (the same one on whose document class I want to call a method).

View 6 Replies

Actionscript 3.0 :: Calling Method On Document Class From Another Class?

Jul 6, 2010

I have a public method on my document class. I want to call this method from another class that is instantiated from within an object in the library of the flash file (the same one on whose document class I want to call a method).

I have tried everything and nothing seems to work. How do I do this?

View 8 Replies

ActionScript 3.0 :: Calling Method From Another Class

Jan 10, 2011

I have two classes, in one (the Start class) I want to run a function I created in another (the Brown class). I commented in Start where I want to call the "addBrownListen" method. I tried doing it with the line:
Brown.addBrownListen();
But that didnt work.

Here are the two classes:
package {
import flash.display.MovieClip;
import flash.events.Event;
public class Brown extends Rebounders {
[Code] ......

View 2 Replies

Actionscript 3 :: Calling A Global Function With Out 'new' Or Having A Static Method

Sep 27, 2011

I'm creating a utility function for debugging/logs, which I access by importing the class and calling

new Log(params);

Alternatively I change the function to a static, and rename it to It,

then I can call it by Log.It(params)

I'm wondering if it possible to set it up so I can simply call Log(params) similar to the trace command?

function:

package
{
public class Log
{

[Code]......

View 1 Replies

Javascript :: Function Does Not Exist When Calling Flash Method From JS

Feb 10, 2012

I have a simple flash socket that I use to connect to IRC servers. It has an open, close, and send method made available to JS through ExternalInterface, for opening connections, closing connections, and sending messages respectively. The socket calls IRC.io.receive in JS whenever it gets a message, which is parsed by JS into something useful.Unfortunately, whenever any of the flash methods are called from JS, they return a "__ is not a function" error.Here's the (watered down) AS, where IRC is the document class:

public class IRC extends MovieClip {
public static function open(url:String, port:int) {/* code */}
public static function close(port:int) {/* code */}
public static function send(port:int, message:String) {/* code */}

[code]....

Any call to any of the functions registered with ExternalInterface throws a "function does not exist" exception.

View 1 Replies

Flex :: Calling A Static Method Of A Class With Only An Instance?

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

Actionscript 3 :: Calling A Classes' Method From Another Class In Flash

Sep 4, 2011

If I have a document class:

package {
import flash.display.MovieClip;
public class Main extends MovieClip {

[Code]....

View 1 Replies

ActionScript 3.0 :: Calling A Static Method From A Class Instance?

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

Actionscript 3 :: Calling A Method From Mxml Component That Is Created From Class?

Jun 16, 2011

I've always just developed my projects in as3 instead of mxml and I usually just setup my application to run a main actionscript file as my main doc root, sort of like how you do it in flash but in flash builder I do something like this:[code] how can I call place a call to that function hitme() within the call_from_outside() function between the <fx:Script> tags?The reason why I'm doing this is because I have some flash swfs that I load into another swf file and I can access the top level public functions of those flash swfs, however the top level of the flash builder/flex swfs is the main mxml file not my fake as3 class root. Of course I should think there is a way for me to access the as3 class methods of the mxml component but for keeping things with the same structure, I can bypass having to modify my loader scripts.

View 1 Replies

Flash :: Calling A Method In Custom XML Class Returns Null?

Sep 7, 2011

I am trying to call a method that has some xml functionality and It keeps coming up null.What I am trying to do is; I have a page that has four dynamic text fields that get their content from an xml file. I would like to create a method that will output the contents to display in the dynamic field. Maybe my approach is WAY off here, but my supervisor wants all xml related tasks contained in a xml.as fileMain.as

package classes
{
import flash.display.*;

[code]....

View 1 Replies

ActionScript 3.0 :: Calling Say Hello Method On Clicking MovieClip?

Jan 26, 2010

If I have a MovieClip, simply a blue square with class AS file called blueBox, in the constructor of the blueBox.as file I have:
this.addEventListener(MouseEvent.MOUSE_DOWN, sayHello);
Why does this not call the sayHello method when I click the movieclip on the stage? I know on the stage that I could grab the instance of my bluesquare movieclip and add an event listener to it that way, but I just wanted to 'encapsulate' in a bit more.

View 5 Replies

ActionScript 3.0 :: Sending A Value From A Class Back To The Maintime Line & Calling A Method

Sep 22, 2009

I'm now finding the great need for classes as my current project is getting quite gummed up with too much scripting in the main document. Becoming a real pain to find stuff with in my code.

So I started writing a class to takes an id passed to it from the main time line, accesses my mySql DB, pulls the related info and the processes it. What I can't seem to figure out, is how to pass a variable back to the main time line. The traces all work, so I know my class works. I've searched here and via google, but I must not be searching the right stuff because I get a lot of results with are usually very complicated questions that don't yield the answers I need.

so here we go. my main.fla (and question):

Code:
import Name;
var theUserName:String = "Joe";
var processName:Name = new Name(theUserName);

[Code]....

ps: what's it called when trying to call a method from the main time line? or passing a property back to the main? are there specific terms for these?

View 10 Replies

ActionScript 3.0 :: Calling A Function From An Extended Class Inside A Top Level Class

Sep 23, 2009

package{
public class Character{
protected var _hp:uint = 50; //Character Health Points
protected var _power:uint = 5; //Damage dealt

[Code].....

I`m instancing a Character and a Player in the Main Timeline, all in frame 1.
When I use: ""player.attack(character)"" it works fine by itself.

So I added the if (defender._hp <= 0) this.win() which gives me the following error:

1061: Call to a possibly undefined method win through a reference with static type Character.

"defender" is a Character instance, "this" is a Player instance and "win()" is a Player method. I try to call the Player method inside a Character method using the Player instance adding the "." and his method name

Do I really need to define the win() function in the Character class? Is there a bypass to use a subclass method in a parent class method if it`s called from an instance of the subclass?

View 6 Replies

ActionScript 3.0 :: Calling A Function Located On The Main Class From A Sub Class?

Nov 21, 2009

I'm not sure that I'm on the right track here. I've got what is essentially a 'gateway' movieclip and depending on the CLICK a corresponding movieclip (form) is loaded -- these all being in their own AS file. There are multiple corresponding pages that will all load/close in their own fashion but the 'gateway' will reload in it's own function-- consequently, I have this function on the main_AS.  Can I trigger this function from the sub class or do I need to move the 'reload' function to a 'reload' class.

View 2 Replies

Actionscript 3 :: Flash - Calling A Function From A Class Within A Separate Class?

Feb 4, 2012

I've been searching around trying to work this out for a while now. There's been various ideas popping up, like dispatchEvent etc but nothing that seems to be a clear, simple way of doing this.What I'm trying to do is call a function from a class seperate (but in the same folder as) my document class.Specifically, I want to 'spawn' an object and run a function within that object's class from my Main.as.The snippet I have at the moment is as follows;

In Main.as:
var object:class_Object = new class_Object();
object.spawn();

[code].....

View 2 Replies

ActionScript 3.0 :: Calling Function In Custom Class From Document Class?

Feb 24, 2009

I keep getting an "undefined property" error when I try to call an external function from within the Doc class. I added the error message to the Doc Class below so you can see where it occurs.

If I take the code from the Tooltip.as below and place it on the FLA's main timeline I can get things working fine, but I would like to move all script to classes. The document class structure looks like this:

Drag_and_Drop.as

Code:
package {
import Tooltip;// Import custom class
public class Drag_and_Drop extends MovieClip {

[Code]....

I realize that I could just combine all the code in the Doc class to get it working, but it would be nice to separate out this particular code which has only one use.

View 4 Replies

ActionScript 3.0 :: Calling A Function In The Document Class Form Another Class

Mar 9, 2011

I'm trying to have a class reference a variable within the document class and have scoured the web but can't seem to find a solution. It seems relatively simple, but is a major stumbling block for me.

I want the variable in the doc class to increment each time a draggable object is within bounds and snapped to a box in the subclass. By tracking successful snaps, the objects will be placed one under the other each time.

View 4 Replies

ActionScript 3.0 :: Flash - Referencing A Movieclip In An Array And Calling A Method?

Nov 12, 2010

Is it possible to refference a movieclip in an array and then calling a methodfor ex.The movieclip i want to refference: main.box.mymovieclip

var current:array = new array();
push(main.box.mymovieclip);
and then like calling a method on it:

[code].....

View 1 Replies

ActionScript 2.0 :: OOP In Flash: Calling A Function W/in A Function Class?

May 12, 2004

Okay so I am reading through sens tutorial on OOP and updating my game that I am making. It is much easier to code this way (IMO) but still hitting snags.I am trying to get through this code:

[Code]...

View 3 Replies

Actionscript 3.0 :: Calling Document Class Function From Another Class?

Jun 12, 2009

I want to call a function that is inside in a document class from another class how can i do this ??

View 1 Replies

ActionScript 2.0 :: Calling A Function W/in A Function Class?

May 12, 2004

Okay so I am reading through sens tutorial on OOP and updating my game that I am making. It is much easier to code this way (IMO) but still hitting snags. I am trying to get through this code:

[Code]...

View 3 Replies

ActionScript 3.0 :: Class Calling Function From Another Class?

May 27, 2010

I have a two classes. One is linked to a menu and controls that. The other is linked to a 'viewer' movieclip. At the start (in the contructor function of the classes that relates to that mc) the 'viewer' mc feeds off an XML document, and an image is loaded into itself. When I click on a menu tab I want the image to change.

Both the viewer mc and the menu mc are on stage already. I tried to import the viewer classes into the menu class...

[code].....

View 6 Replies

ActionScript 3.0 :: Class Calling A Function In Another Class?

Oct 19, 2010

I;m converting some of my as2 classes to as3 and have run into a problem where my ships class cannot seem to call my vectorGraphics class. They are in the same folder (sprites).

The basic flow is this: On the main timeline I instantiate Ships and vGX.

ActionScript Code:
import sprites.ships;
import sprites.vectorGraphics;

[Code].....

View 2 Replies

ActionScript 3.0 :: Calling A Class Function Within Another Class?

May 8, 2010

I've been searching around the forums to find a solution of this problem. I have two classes: Monster and Player. Constructors are defined and the classes by themselves apparently works. My problem is that I want to get player.x inside the Monster class.

[Code]...

View 5 Replies

ActionScript 3.0 :: Calling A Function From A Class?

Sep 26, 2010

I want to call a function on the "Driver" class which is the main document class, from another class.

but i always get this error. 1061: Call to a possibly undefined method Test through a reference with static type Class. here is the main document.

[Code]...

View 5 Replies

Flex :: Calling A Function From A Class?

Jul 27, 2009

package asas
{
public class main extends EventDispatcher[code].....

I have this class and a MXML file... how will i call the function doCheck in button. When i call like this, it throws me an error.

<mx:Button
styleName="LoginButton"
id="loginButton" [code]...

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved