ActionScript 3.0 :: Root Access To Method In Document Class From Loaded Swf
Jan 26, 2010
Im having whta I think is a quite common problem. I recently started migrating form AS2 to AS3 and Im buidling a home made template for all AS3 projects..
I have just loaded portfolio.swf on top of main.sfw. The buttons on portfolio.swf share the same class as the buttons on main.swf
This is the button class:
Code:
package com{
import flash.display.*;
import flash.events.*;
[Code]....
View 9 Replies
Similar Posts:
Nov 13, 2010
Anyways, I've been trying to figure this out for quite some time.Let's say I have my document class. I'm guessing the document class can correspond to the first thing that gets run? (such as the "main" function in most C++/low level languages).If I set a variable in it:var myNumber:Number = 10;how would Iaccess: "myNumber" from other objects in my stage?Like a movieclip on my stage for example.If I go inside that movieclip into the movieclip's first frame, how would I say:trace(TheDocumentClass.myNumber);Another similar question is, what about the actual stage frame?If I click on frame 1 of my stage, set a variable:var aNumber:Number = 5;how would I access it from other objects?In my movieclip's first frame, what would I put?trace(root.aNumber); ?trace(stage.aNumber); ?
View 9 Replies
Feb 12, 2011
I'm using a PreLoader as a parent SWF that loads the actual website as a child SWF. In the website SWF, the child SWF, will MovieClip(root) still work and refer to it's own root, or the PreLoader's root? And would I still access the websitite's document class (the child's document class), through MovieClip(root)? What if both files have a document class?So my main question is how do document classes and MovieClip(root) behave in the scenario when you have:
Parent SWF - document class, MovieClip(root)
|
Child SWF (loaded by parent) - document class, MovieClip(root)
View 2 Replies
Aug 30, 2010
If I wanted to do something like this:
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"
horizontalScrollPolicy="off"
verticalScrollPolicy="off"
[Code].....
How would I get a handle on myCanvas (where I'd want myCanvas to be the root )?
View 2 Replies
May 7, 2011
I have a FLA (say Main.FLA) document class with a child MovieClip on the stage: into the child MovieClip I load other swf files: each of the files contains its own Document Class (every swf is a somewhat independent application, say quizzes and so on).For some reason I must use the Main document class to store data (scores or so) from the child swfs loaded into the Main swf. HOW do I reference the Main class? I can't find a way.[code]and dispatch an Event this way from the loaded swf document class to the Main class:[code]Now, first of all I don't know if this could even work. Secondly, I tried to make it work by adding an event listener to my Main class but id did not work.
View 9 Replies
Aug 27, 2010
How are they related?
Are they the same?
Is using "MovieClip(root)." from anywhere actually equivalent to coding in the document class?
What's different in their effect on the display list?
View 1 Replies
Sep 28, 2009
So I have a MovieClip symbol created in the Flash IDE with a baseClass of flash.display.MovieClip and Class name of "Square". I have placed it on the timeline of my fla at frame 30 and given it an instance name of "square". How can I control that MovieClip from my DocumentClass? I have an ENTER_FRAME listener listening for the arrival of frame 30. At that time I want to simply do something to the "square" MovieClip. But I keep getting a compile-time error of "1119: Access of possibly undefined property square through a reference with static type flash.displayisplayObject.".
[Code]....
View 1 Replies
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
Jan 13, 2011
I am migrating to AS 3.0 from AS 2.0 and I am unable to access the root of the main swf from the loaded swf. In AS 2.0 i simply used "_root.gotoAndPlay(frame number); I have also tried Movieclip(this.root).gotoAndPlay(frame number); but it doesn't work.
View 1 Replies
Jan 13, 2011
I am migrating to AS 3.0 from AS 2.0 and I am unable to access the root of the main swf from the loaded swf.In AS 2.0 i simply used "_root.gotoAndPlay(frame number);I have also tried Movieclip(this.root).gotoAndPlay(frame number); but it doesn't work.
View 3 Replies
Mar 23, 2009
I have two classes:
1. DocumentClass
2. GameClass
I would like to be able to call a public method of DocumentClass from GameClass. I don't know how to do that, I tried instantiating an object of DocumentClass within GameClass which simply throws me into an endless loop and after a short while application crashes.
View 2 Replies
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
Jan 13, 2011
I am migrating to AS 3.0 from AS 2.0 and I am unable to access the root of the main swf from the loaded swf.
In AS 2.0 i simply used "_root.gotoAndPlay(frame number);
I have also tried Movieclip(this.root).gotoAndPlay(frame number); but it doesn't work.
View 1 Replies
Oct 20, 2010
How can I access variables defined on root from a loaded movieclip? The loaded movieclip path can differ, so I cannot get to root like parent.parent, for example. I thought something like this.root.varName may work, but it obviously doesn't.
View 3 Replies
Dec 6, 2010
I have this in my fla (Actionscript 2)
import com.pw.Pts;
var gUnitId:String;
I have this in Pts.as
class com.pw.Pts {
function Pts()
{
trace ("Inside constructor");
[Code]....
I want the variable gUnitId in the fla file inside the class file.
View 5 Replies
Mar 7, 2012
How to access a display object on the stage in a class which is not a document class?
I am looking for a solution that doesn't involve passing the stage as a parameter to the class.
One solution i always come across is using "TopLevel.as". Is it a good method because as far as I have heard using global variables is not recommended because it might cause some problems while working on big projects.
View 1 Replies
Mar 22, 2010
I have a root stage, and a MC that is called from the root stage.Now from that MC, i will called in another MC2, and I wanted to placed the MC in the center of the stage. The reason I could not use normal ADDED_TO_STAGE at MC and define the center is because MC is not place in the exact position of the root stage (as in x, y=0). So if I would target MC2 at MC stage center, it would not be the exact center of the root stage/screen.How can I called the root stage properties rather than adding MC2 into the stage?
View 1 Replies
Feb 1, 2011
Do you need to have a destroy/dispose method on your Document Class? Say I have a Document Class that has the following
- mouse event listeners
- timers running and or enter_frame listeners
- class variables
Do I need to have a destroy or dispose method that:
- removes event listeners
- stops timers
- nulls class variables
Or is this only something I need in other objects (sprites, movieclips) that are added to the stage of the Document class?
View 2 Replies
Apr 11, 2010
I have built a button in the fla timeline and need to have it fire a method in a document called gigyaSocial. the Timeline code works fine but I cant get it to recognise the method that I commented out at the bottom if this code snipit.
ActionScript Code:
import fl.controls.Button;
import com.player;
import com.gigyaSocial;
[Code]......
View 9 Replies
Mar 3, 2011
Going further on my app, I felt in another problem. Despite having lots of posts on the web regarding this, none of the solutions worked for me In my document class (Main.as) ve two containers. One empty and another with a star that is being imported from the library. Here´s the main class:
package
{
import flash.display.*;
[code]......
View 4 Replies
Jul 16, 2010
I have a SWF file having different scenes. This swf has one document class. I want to notify an event to a particular scene, when a change is happening in any function in document class. For example:
I have 3 scenes in an SWF and one document class. When a function will be invoked (from lower layer) in document class, I want to disable the button controls in Scene 2. How this is possible?
View 7 Replies
Aug 6, 2009
I've got a document class (EgoGame.as) and another class (Ball.as) which has been duplicated to deal with several different video pieces. Inside the document class is a list of 'if' statements which decide which video should be played. At the moment I'm doing it the old fashioned way whereby if the condition is true....it tells the relevant Ball class to gotoAndPlay a certain frame within the linked movieclip...
[Code]...
View 1 Replies
Feb 9, 2011
I am trying to code a flash app entirely in the document class. I am using GestureWorks with a touch screen. When a user essentially presses a button it calls a method that should hide a specific graphic but not the graphic they touched.
Essentially I need a way to refer to a graphic on the screen using a method besides 'e.target'.
I am receiving this error: Error #1009: Cannot access a property or method of a null object reference.
[Code]...
It can access photo1Sprite as 'e.target' when the button click happens on the photo1Sprite. The problem happens when to click one button (not photo1Sprite) and have it effect photo1Sprite. So I can make photo1Sprite react if my method is attached to it directly using 'e.target' but not if I am trying to call it from a method that was called from another element on the screen.
View 1 Replies
Jan 27, 2010
Got two classes "Engine.as" and "Player.as". Engine.as is the document class that is calling Player.as.
The point is to have Player.as create a movieclip on the stage, but it seems it cannot access the library or something. Because when the player class is at the createHero() method it gives me the "error 1009 cannot access a property or method of a null object reference"
Engine class:
Code:
package test{
import flash.display.*;
import flash.events.*;
[Code]....
View 2 Replies
Nov 28, 2010
Im getting this error: 1180C: as3_scrollbarAS3 ScrollbarsrcclassesMain.as, Line 1 1180: Call to a possibly undefined method addFrameScript. the actionscript in my .fla timeline is: _scrollBar = new FullScreenScrollBar(_content, 0x222222, 0xff4400, 0x05b59a, 0xffffff, 15, 15, 4, true); addChild(_scrollBar)
[Code]....
View 5 Replies
Oct 3, 2011
It seems simple, but it doesn't seem to be working I have 2 as3 files as classes "mainclass.as3 (this is the document class)" and GamePlay.as3
the GamePlay class works flawlessly on it's own, but when i try to create the var to access it ... var gp:GamePlay=new GamePlay(); ... i get the following error.
I have looked at tutorial etc, but i cant get it to work i am currently getting the following error.[code]...
View 1 Replies
Sep 21, 2010
It used to be simple to access an object you put on the stage like a mc or dynamic text field by simply using _root.instanceName ect. Now I see references to making references to the Stage and such like:
private var stage:Stage;
stage = stageRef;
and I am still confused.
What I have going on is, I have placed a movieclip on the stage in Flash and gave it an instance name of Cell_mc.I have a cusom class that extends MovieClip with the following imports
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.EventDispatcher;
[code]....
This Class is tied to a set of MovieClips in my Library.
I have a listener: this.addEventListener(MouseEvent.MOUSE_DOWN,pickUp);
And a function:
private function pickUp(event:MouseEvent):void
{
this.startDrag();
[code]....
I get the following error whenever I try to access an object I placed on the stage from anywhere other than the document class:
1120: Access of undefined property Cell_mc.
How do I access the cell_mc that is already on the stage from this non-document class?
View 5 Replies
Sep 30, 2009
if i want from a document class to access some variables in other classes (which are imported into that document class) does these variables need to be public to access them or they can be something else?
View 9 Replies
Nov 14, 2010
How do I access the timeline from the document class? I tried: trace(this.parent as MovieClip)
but I got a null object.
View 9 Replies
Jan 30, 2009
I was wondering if it was possible to access the document class from within a movieclip.
I am creating a slideshow type project, and I'm using a document class to switch between the frames using the arrow keys. However, in one of the "slideshow screen" movieclips, I want to have it stop, and then play another part when the arrow key is pressed again.
I tried to access my nextScreenToPlay method within the document class, but whenever I try to do it within a movie clip, I get this error: Call to a possibly undefined method nextScreenToPlay through a reference with static type class.
If I do a trace(Main), within a movieclip, it shows the class.
View 1 Replies