ActionScript 3.0 :: Calling Function From Subclass To Home / Doc

Jan 12, 2010

I seem to be having some difficulty calling a function from my subclass to home/doc class. I am trying to click the button called "GalleryButton.swf" (located in in Home page.as) to add a function called "addGal". (Also located in in Home page.as) to call a function from my main/doc class to work, called "gallery". Which indeed removes my home page from the stage and adds my gallery page to the stage.

I receive this error:
ReferenceError: Error #1069: Property gallery not found on flash.display.Stage and there is no default value.
at HomeClip/addGal()

EXAMPLE CODE - NOT FULL
I have import code such as:
import flash.net.URLRequest;
import flash.display.LoaderInfo;
etc etc. Because the pages to transition using buttons from the navigation class, its just that a button from homeClip.as, won't call the function "gallery" on the main class needed to add the gallery page to the stage.

Main Class - (holds the functions to add pages)
Code:
package {
public function StartHome() {
trace("addingHome");
addChild(_NavigationBar); //ADDS NAVIGATION CLASS//
_NavigationBar.name="NavBar";
} public function home() {
[Code] .....

View 9 Replies


Similar Posts:


ActionScript 3.0 :: Calling Objects From Main Class In Subclass?

Oct 18, 2010

so i'm working mostly in a main class file. up until now subclasses (or the class for objects that i'm using in my game) have really only contained methods that controlled property values, and properties. however, i'm now interested in making an enemy in my game, but doing almost all the code for the enemy in the class file. i need to figure out how to communicate and check the object instance of the class against an object instance being controlled by the main class.

View 13 Replies

ActionScript 3.0 :: Calling Subclass Method Through Variable Typed To Superclass

Nov 26, 2008

It's early days in my AS3 learning, and I'm looking for a little clarification regarding a variable typed to a superclass (in this case var mySpinner:MovieClip) which contains a reference to an new instance of a subclass (in this case Spinner.) I am trying to get my head around why my code compiles and runs and I am able to call the method rotater() on mySpinner even though mySpinner is typed as MovieClip, and the MovieClip class does not contain the method rotater().

On page 163 of the official Adobe Programming ActionScript 3.0 documentation it says the following, which I believe is related to my situation, but I am still in need of clarification:
"Because each class defines a data type, the use of inheritance creates a special relationship between a base class and a class that extends it. A subclass is guaranteed to possess all the properties of its base class, which means that an instance of a subclass can always be substituted for an instance of the base class."

View 2 Replies

AS3 :: Flash - Reference SubClass Of SubClass From Parent Without Instantiating?

May 1, 2011

Can I access a static variable of a subClass' subClass? I don't want to instantiate it, just looking to get the variable because it has already been initialized by the subClass.example:

package
{
public class A extends MovieClip {
private var classB:B = new B();

[code]....

View 3 Replies

Actionscript :: Overriding A Protected Function In A Subclass?

Sep 26, 2011

I'm overriding a protected function in a subclass.Let's say I have two classes, Apple and Fruit. I have all variables in place, this is just a simplified version.

[Code]...

Example is trivial. The problem is that the type of the getRandom function depends on its own type. One returns an apple, the other returns a fruit.Of course I get errors about override and coercion.

I've tried returning a Fruit instead of an Apple, but then the object is not an apple, therefore it has no Apple-specific properties.The problem is in ducktyping. There's a third class I cannot change, that executes the getRandom() function on each object, and I need the Apples to be something slightly different.

How can I override the getRandom function in Apple, so that it returns apples, rather than fruit?

View 1 Replies

ActionScript 3.0 :: Subclass, Overriding A Function Not Marked For Override?

Nov 9, 2011

I have a .fla and one.as(DisablingButtons.as).The .fla currently has only one key frame and three movie clips.First movie clip has base class flash.display.MovieClip and class DisablingButtons.as.The other two movie clips have base class DisablingButtons and their own classes (set by flash on export). The movie clips have identical timelines, 20 frames, two motion tweens, and the only action is stop();on frames 1,5,10,15. I get two errors:5000: The class 'DisablingButtons' must subclass 'flash.display.MovieClip'and 4 copies of 1024: Overriding a function that is not marked for override (on frames 1,5,10,15 of movie clip #2)

I am importing flash.display.MovieClip and have public class DisablingButtons extends MovieClip.Code below...[code]..........

View 2 Replies

Actionscript 3 :: Create A Subclass That Takes In Different Parameters For The Same Function Name?

Nov 1, 2011

So I have made this simple interface:

package{
public interface GraphADT{
function addNode(newNode:Node):Boolean;[code]........

Having this setup here is giving me errors, namely:

1144: Interface method addNode in namespace GraphADT is implemented with an incompatible signature in class AdjacancyListGraph.

Upon closer inspection it was apparent that AS3 doesn't like the different parameter types from the different Graph classes newNode:Node from Graph , and newNode:AwareNode from AdjacancyListGraph

However I don't understand why that would be a problem since AwareNode is a subClass of Node.Is there any way I can make my code work, while keeping the integrity of the code?

View 3 Replies

ActionScript 1/2 :: Home.swf That Is Inside Home.html?

Jul 27, 2009

I have a home.swf that is inside home.html.inside home.swf there is a btn with the following
 
cinema_btn.onRelease = function() {loadMovieNum("video_main.swf", 0); 
inside video_main.swf  is the following 
loadMovieNum("video1/reels.swf",1);
 
the idea is to load reels.swf in level1 on top of video_main.swf in level 0 why reels.swf size looks much larger even though all swf's are 900 x 800?

[Code]...

View 2 Replies

Flash :: Calling OnLoadProgress Function From Inside Another Function?

Sep 23, 2011

I have an AS3 function that loads and audio file and then plays it. I have the pre-loader for the first audio file working - now I need to run the pre-load function before the 2nd audio file starts.

myMusic.addEventListener(ProgressEvent.PROGRESS, onLoadProgress2, false,0, true);
myMusic.addEventListener(Event.COMPLETE, playMusicNow, false, 0,true);
myMusic.load(soundFile, myContext); //This code works

[code].....

View 2 Replies

ActionScript 3.0 :: Calling A Function From A Private Static Function?

Feb 26, 2010

i'm trying to modify some code and can't figure out what the issue i'm having it. this is the(shortened) code:

public static function Lose():void {
trace("OVER!");
Clock.stop();[code]...

this is the error i get: 1180: Call to a possibly undefined method OverIt.i just want to call a function from inside of the public static funtion.both function are inside this class:

public class Game extends MovieClip {
}

View 4 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 A Function That's Inside Another Function?

Dec 8, 2009

function test1():void
{
function test2():void {..}

[code].....

View 6 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 2.0 :: Calling Function Inside A Function?

Mar 23, 2010

how can i call a function that is inside another function.like:

Code:
function abc() {function uvw() {
}
function xyz() {[code].....

View 3 Replies

ActionScript 2.0 :: CS3 A Function Calling A Function In A Function?

Oct 9, 2010

I'm trying to get this one function to be able to call many functions (not at once, but call many possible ones)In other words, I'm trying to get this variable to be named as a function. That way, this one variable can create multiple functions.example:

actionscript Code:
class Thing extends MovieClip{  var funcvar;  var othervar; function onLoad()  funcvar = "YYY";  othervar = "ZZZ"; function onEnterFrame()

[code].....

View 1 Replies

ActionScript 3.0 :: Calling A Function From Within A Function?

Mar 8, 2010

I hope that this is possible. I can't seem to find any info on it on the web. I need to call a function from within a function. I'm not sure if there is a name for doing this that I don't know of?This is some example code of what I'm trying to achieve:

Actionscript Code:
someTimer.addEventListener(TimerEvent.TIMER, functionWithin);function mainFunction():void{  function functionWithin():void  }}

[code]....

View 3 Replies

ActionScript 3.0 :: Calling Function In Other Function?

Sep 11, 2009

how can i open "insider" function from "start_function"?

ActionScript Code:
start_function();
function start_function():void {

[code].....

View 3 Replies

Actionscript 3.0 :: Calling A Function That Is Not A Function?

Sep 25, 2009

I read online, and I understand kinda what the error is stating. Though, I can't find out why.So basically what I understand is that I am calling a function that is not a function?ere is the error and code portions that are required.TypeError: Error #1006: value is not a function.at VideoPlayer_fla::MainTimeline/startVideoPlayer()at VideoPlayer_fla::MainTimeline/frame1()

View 2 Replies

Php :: Calling A Page With MySQL Query From Javascript Function Then Returning Results To Another Javascript Function

Jul 8, 2010

I am refactoring some code. I have a PHP page that contains a MySQL query and stores the result in a PHP variable $my_result. This result is then echoed to a Flash SWF during embedding with SWFObject. I now want to call this PHP page that makes the query from a javascript function like so - one change I have made to the PHP is that instead of storing the result in a variable $my_result I am echoing the result. Javascript function to call the PHP page and make the database query

[Code]....

View 2 Replies

Flash - Calling The Function Within That Function And Later Stopping The Loop - Starting And Stopping Functions?

Jan 7, 2012

I am making a character walk. This code will make him wobble to the right and when thats done it will trigger him to wobble to the left and then call the function again to continue the loop.I can get the loop to work fine by calling the function but how do I STOP the function? Also I want to call it later on. Is there a way to start and stop a function?

function wobble()
{
var ws = .1;
var dis = 1;

[code]....

View 2 Replies

ActionScript 3.0 :: Sloppy Global Function By Calling Global Function Class

May 14, 2009

I'm try to calling my sloppy global function by calling my global function class as u can see below.[code]

View 2 Replies

ActionScript 3.0 :: Who Is Calling The Function

Jan 16, 2009

i have a movie clip of a square in the library exported as Square1, i place 2 instances of it on stage and push them to an array called ar i add event listeners to both ar[0] and ar[1] to do a certain function. i need flash to tell me wheter ar[0] or ar[1] called the function.

View 6 Replies

ActionScript 2.0 :: [FMX] Calling The Same Function Twice

Dec 11, 2003

the *who.say* in the following function refers to a var displayed inside a dynamic text box.

when I tryed to call the function twice, from the same MC, only with different Who's and What's, it didn't work. only one call displayed the text.

//*who is talking, what is he saying, and for how long his text is displayed**
function saythat(who, what, fortime) {
starttime = getTimer();

[Code].....

View 2 Replies

ActionScript 2.0 :: Calling Function From Within Another One

Mar 2, 2007

I'm writing a class that utilizes the whole screen resolution and need a movieClip to adjust itself in accordance to that. That "almost work". The problem is that I cannot call functions when the resize listener kicks (onResize = function()) in, and I don't understand why I want to call the function centreMe() from within the onResize function.

Code:
import mx.transitions.Tween;
import mx.transitions.easing.*;
import mx.utils.Delegate;
class centre {
public function centre() {
[Code] .....

View 3 Replies

ActionScript 3.0 :: Calling A Function?

Feb 9, 2010

In my application in the first frame I have the following: this is a simplified version,

Code:
import com.Menu.Menu;
import com.Papervision.Papervision;

[code]....

View 13 Replies

ActionScript 3.0 :: Calling A Function In A Loaded Swf?

Aug 1, 2009

I'm using FLex Builder and in my Main class I load an external swf. In the external swf there is a movieclip on the stage called house. In the library I have that movieclips Class name set to a class I defined called com.buildings.House

When I load the swf from the main class I'm trying to access a function called setup in the class called House. I have tried a bunch of different ways but I get errors for them all.

Code:
private function onLoadSwf( url : String) : void
{
var loader : Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onImageLoadComplete);
loader.contentLoaderInfo.addEventListener(Event.INIT, onLoadInit);

[Code]....

I'm at a loss right now and its driving me mad. In flash I used to use the var externalSwf : MovieClip = evt.target.content; example and it worked but with Flex Builder its throwing error saying setup is not a function.

With the Imap interface its saying externalSwf is null.

View 6 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

ActionScript 3.0 :: Calling A Function From XML Images?

Mar 14, 2009

I have a program that is displaying a number of images from an XML file. The images are being resized and displayed through a loop function. I'm creating a new Loader each time through the loop and adding it to the stage. The problem is, I then want to create an event listener that will call a function for a mouse event for each image. The first issue I'm running into: how do I determine which image is which after loading them to the stage (say I want to display a large version of the image when the small image is clicked)? Secondly, since I'm creating the Loader within the first function, how do I pass the Loader to another function, say the one called by the mouse event listener? I'm sure I'm going about the fundamentals the wrong way.

View 3 Replies

ActionScript 3.0 :: Return To A Calling Function?

Dec 15, 2008

I have several buttons calling the bounceOut() function andthe bounceOut() function calls the onMotionFinish() function. Afterthat function is finished I want to go back to the original callingFirst a call is made to bounceOut() when a button is clicked.I have ten buttons.

function bounceOut() {
var smSlide:Tween=new
Tween(sideMenu_mc,"x",Regular.easeOut,200,-200,2,true);

[code].....

View 2 Replies

ActionScript 3.0 :: Calling Function From Main.as?

Sep 1, 2008

I have a buttons class I would like to access but not sure of proceedure. Here is the Main.as

and here is the button class

this is actions layer:

View 1 Replies







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