ActionScript 3.0 :: Changing Scenes From A (non-document) Class?

Feb 29, 2012

I have a non-document class that I want to put in charge of changing scenes when some conditions are met.First things first, I need to figure out how to change scenes!Here's my code:

Code:
package classes {
import flash.display.MovieClip;

[code]....

View 8 Replies


Similar Posts:


ActionScript 3.0 :: Document Class - Adding More Scenes To Flash

Sep 7, 2008

From a tutorial page, I manage to built this flash page with xml capabilities. But when I add more scene to the flash page, I have errors like this.

TypeError: Error #1009: Cannot access a property or method of
a null object reference.
at MyContent/init()
at MyContent()
TypeError: Error #1009: Cannot access a property or method of
a null object reference.
at MyContent/onComplete()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()

How do I edit the "MyContent.as" file so that I can add more scene to the flash. I understand that, once i put the "MyContent.as" in the document class, it will load immediately, is there any way to tell it to load only in scene 2 (which is where the xml is needed).

View 1 Replies

ActionScript 3.0 :: Handle Controls In Multiple Scenes In A Document Class?

Jun 30, 2010

I have swf with multiple scenes.Controls in each scenes are different. How can I manipulate these controls in different scenes in a single document class for this swf?

View 1 Replies

ActionScript 3.0 :: Changing A Document Class To An Imported Class?

Oct 23, 2009

My following document class is working fine. But, when I want to import it instead of using as a document class, it reports an error "1067: Implicit coercion of a value of type Class to an unrelated type flash.display:DisplayObject.". My class code is here:

package{ import flash.display.Sprite; import flash.display.Shape; import flash.text.TextField; import flash.events.MouseEvent; public class Shapes extends Sprite {  var square: Sprite = new Sprite();  var txt: TextField = new TextField();  public

[code].......

View 2 Replies

ActionScript 3.0 :: Flash - Dispatching An Event From One Document Class And Listening For It Via Another Document Class?

Dec 14, 2010

I am dispatching an event from one document class and listening for it via another document class.My code in class A.

Code:
this.dispatchEvent(new MYEvent(MyEvent.APERTURE_DONE));
trace("Dispatching APERTURE_DONE");

my code in class B.

Code:
addEventListener(MyEvent.APERTURE_DONE, onDoorsOpen,true);
trace("Lisetning for APERTURE_DONE");

[code]....

My listener is registering before the event is dispatched, based on my output window, however I never get the "Open Doors" trace statement to fire.

View 2 Replies

ActionScript 3.0 :: Reference Main Document Class From Document Class Of Loaded Swf

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

Professional :: Creating Different Document Sizes For Different Scenes

Dec 20, 2010

is it possible to create different document sizes for different scenes in Flash?

View 1 Replies

Actionscript 3.0 :: Document Classes And Multiple Scenes?

Sep 2, 2010

I've been searching the internet for how to use scenes in flash games, and from what I understand it got some problems? MY problem is that i cant really understand what the problem is and I cant find i "clean" explanation.

Some say you dont should use scenes in game development, some say you should?? Im confused.

Another thing that i dont understand quite is the document classes. Should i have one document class for every scene or one for all of them?

If i have 2 scenes with it's own document classes, how do i switch between them?

View 4 Replies

ActionScript 3.0 :: Document Classes And Multiple Scenes

Sep 2, 2010

I've been searching the internet for how to use scenes in flash games, and from what I understand it got some problems? MY problem is that i cant really understand what the problem is and I cant find i "clean" explanation.Some say you dont should use scenes in game development, some say you should?? Im confused.Another thing that i dont understand quite is the document classes. Should i have one document class for every scene or one for all of them?

View 1 Replies

ActionScript 3.0 :: Moving Document Class .fla Cannot Find The Document Class - WTF?

Sep 22, 2008

So I had a working .fla, with a document class package in the same directory. Everything was fine, until moving both to a new directory, now the fla cannot find the document class. WTF?

View 2 Replies

ActionScript 3.0 :: TypeError #1009, But Only When Changing Scenes?

Oct 11, 2010

I have a feeling this is a stupid thing that I'm either overlooking or ignorant of,I have a simple Flash piece that is two scenes -- Intro and Body.Intro plays fine, but when the timeline enters the final frame of the scene it is supposed to go directly into the Body scene. Here is the AS I placed in the final frame of the Intro scene:

stop();
this.addEventListener (Event.ENTER_FRAME, EnterFrame);
function EnterFrame (event:Event):void

[code].....

View 4 Replies

Actionscript 3.0 :: Changing Scenes On Button Press

Mar 22, 2011

im using cs5 and trying to change scene on button press. the code im using is :

[Code]....

it brings up no errors, but does not change the scene.

View 4 Replies

Flash :: AS2 Acts Randomly When Changing Scenes On The First Frame

May 15, 2010

I have a flash movie containing to scenes: scene1, scene2. I have chosen the order so that scene1 starts first, I was requested to add a functionality to allow flashvars to be passed, if fv_change equals one then scene2 should be the first to appear when the movie is loaded. I have included the following code in scene1 first frame of some layer:

[Code]...

View 2 Replies

ActionScript 3.0 :: Null Object Reference Error When Changing Scenes

Oct 20, 2009

I have an error that is not negatively effecting anything, but I'd rather fix it if I can. I have to do with "MouseEvents" when I change from one scene to the next. As in the objects do not exist in the "new" scene so there is a "null object referenced" error. The objects are not referenced in the new scene. Its a "mouseOver" and so when the scene changes and the "MouseOut" happens it tries to exicute a funciton on an object that is no longer available. I was thinking of changing the functions to "if/Else" statements, as in:
"if currentScene=X Mouse out, Else "NOTHING"

View 2 Replies

ActionScript 3.0 :: Button Isn't Working When Changing Scenes Inside Movie Clip

Apr 29, 2011

I'm having some problems controling my site. I have a movie clip and inside this movie clip I have an action script to take me to a diferent scene but the button isn't working

[Code]....
 
When using this code in the main timeline it works great but when I put the code inside a movie clip it won't work

View 3 Replies

ActionScript 3.0 :: Changing The Flash Document Size?

Dec 13, 2009

can you change the size of a flash document dynamically or with as3 and have the browser scroll bar recognize it and where could I find any information on this

View 1 Replies

IDE :: Dynamically Changing Flash Document Dimensions?

Apr 22, 2005

I'm creating a website that requires full flash. Within the file structure of a main swf there are other swfs being loaded into it (ie different pages). I need to be able to scroll the content of these swfs in the browser window.So say that the main swf is 800 x 600px and I load the initial page which is 800 x 500 px. This obviously doesn't need to be scrolled when viewed in the internet broswer. However, when the user clicks to go to another page it might load a page of 800 x 1300 px which is larger than the first and so needs to be scrolled in the internet browser. The main swf in which these pages are loaded into is only 800 x 600 (and even if the HTML dimensions - when put on a webpage - are set to 100%, the swf being loaded into the main swf doesn't have an impact on the size of the main swf, of which the browser goes by for scrolling.

I could of course just set the size of the main swf to the height of the largest page and have the browser scroll a whole lot of nothing when a smaller page is loaded, but aesthetically its not too great. And since I don't want the entire page to reload when a user clicks to go to another page I've got a problem on my handsI was thinking of using a script that would dynamically change the html object properties (height value) to the height of the page the user has clicked to go to.

View 12 Replies

Actionscript 3 :: Flash CS5 Reference A Display Object From A Class Other Than The Document Class

Jul 28, 2011

Using Flash CS5 Professional I have created a symbol, dragged it onto the stage, and given it an instance name of GreenLight1. If I want to make this visible from the document class, I can simply do the GreenLight1.visible=true; and poof it's good to go when I test the file. As long as I stay in the document class I am good to go, but now I'm trying to move to another class and hitting ALL kinds of trouble just trying to get Flash to allow me to access this simple object. All I am looking to do is have this GreenLight1 go invisible (visible=false) when a certain condition occurs in this new class and Flash just won't let me access GreenLight1 at all. Things I've tried thus far:

stage is passed to the class and is referenced by _stage and is working just fine when I do _stage.addchild or anything like that. So I have tried "_stage.GreenLight1.visible=false;" and I get "ReferenceError: Error #1069: Property GreenLight1 not found on flash.display.Stage and there is no default value." My document class extends Sprite, so I figured I'd try the root function. So I tried "Sprite(root).GreenLight1.visible=false;" and I get "1119: Access of possibly undefined property GreenLight1 through a reference with static type flash.display:Sprite." I tried to create the Resource class as described therein. To which I came across the same problem that I started with in that it doesn't know what GreenLight1 is to begin with so I got "1120: Access of undefined property GreenLight1." Here is my code for Resource.as (am I supposed to pass something to this class from the document class?)

[Code]...

View 2 Replies

Actionscript 3 :: Can A Document Class Extend Another Custom Class That Extends MovieClip?

Aug 16, 2011

If I have a Document class that extends MovieClip, and I want to use it as the basis for another Document class, is it possible to create a subclass that extends the main document class and use that for a different FLA?

For example,

fla1.fla has a document class of MyMainClass:
public class MyMainClass extends MovieClip
fla2.fla has a document class of MySubClass:
public class MySubClass extends MyMainClass

I've tried, but now I'm getting errors that all of my variables that reference stage instances aren't being found.

View 1 Replies

Actionscript 3 :: Call A Server Side Script - Whether In A Document Class Or Sub-class?

Mar 13, 2012

while working with a server side script (php or aspx) which returns some data(from the database) can we call it in a sub-class or do we have to make the calls in the document class itself?

View 2 Replies

Actionscript 3 :: Communicate With Server-side Script - Only In Document Class Or In Sub-class?

Mar 14, 2012

Say i need to send some data from AS 3.0 to a server-side script for it to do some actions. Can I do this in a sub-class called some where in a document class or should we always do it in a document class?

View 1 Replies

ActionScript 3.0 :: Referencing A Textfield Inside A Movieclip Class From Document Class

Feb 3, 2009

Ok, this is one of those walls that I know once I can jump over it, I will be a much happier developer again.

I've done tons of reading, and think I have a firm understanding that the general consensus is that if you want to reference something, it needs to be added to the display list, using addChild().

I hate to be defiant, but what if I don't want to?

Or at the very least, what if I want to add a movieclip class to the stage using addChild, and then reference objects inside it?

It is much easier this way than what most people recommend - adding 15 objects via addChild, then setting the x and y for the, etc.

That said, I'm all about using classes and using as3 the way it was meant to be used. So what this is, is a best practices question I guess.

HERE ARE THE STEPS I'M TRYING:

- Create new flash document

- Draw graphic symbol bg, with text field over it, select them, convert to movieclip symbol, and export class name "box", then delete it from stage

- Add document class .as file, which simply adds that class "box" from the library, to the display list using a simple addChild()

- Set a name for that box using box.name = "test" let's say

- Do a simple trace like the following - "getChildByName('test').textFieldName" - it shows up great

- So then, I'll now try to set the text by doing this - getChildByName('test').textFieldName.text = "yo";

That last line above, is what doesn't work. I know I'm referencing wrong, but how would a pro as3 developer, reference something on the stage within a movieclip class, from the document class?

View 1 Replies

ActionScript 3.0 :: Passing Variable From Document Class To Movie Clip Class?

Oct 12, 2010

i have a movie clip which is exported for ActionScript , i want to get a variable from the document class into the movie clip class i tried this but there was an error !!

ActionScript Code:
var main:Main=new Main();
main.txtScore.text="hello";

View 1 Replies

ActionScript 3.0 :: Pass Data From Custom Class Back To Document Class?

Apr 20, 2011

I have a custom class created by a main document class, and I want the custom class to run a function in document class after some time.

How can I sent the instruction from custom class back to the document class?[code]...

View 6 Replies

ActionScript 3.0 :: Reference Movieclip On Stage From Custom Class Of Document Class

Dec 7, 2009

Is there a way I can reference a Movie clip I have on the main stage from a custom class of a document class?[code]

View 1 Replies

ActionScript 3.0 :: Class Is Loading The File But When Return It To A New Xml Object In The Document Class It Doesnt Load It?

Aug 18, 2009

I found myself loading a new XML file every day and so decided to create a small class that will load the xml file and return it.The class is loading the file but when i try to return it to a new xml object in the document class it doesnt load it.I think that it's something to with the return being in a nested function but i tried a few ways and non seems to work.
 
[DOCUMENT CLASS]
loadXML:LoadXML = new LoadXML();
myXML:XML = new XML(loadXML.loadXMLFile("gallery.xml"));[code].....

View 1 Replies

ActionScript 3.0 :: One Main Class - Error With Frames / Scenes

Feb 12, 2011

I am getting errors with flash cs5 classes I am using one main class and I've got to make a menu and normal game so two scenes (1 menu 2 main game). I keep getting this error when i play the movie. I am using CS5 IOS Packager

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at ButtonClass()[C:UsersMY NAME COMPDesktopIOS ContentButtonClass.as:68]
at runtime::ContentPlayer/loadInitialContent()
at runtime::ContentPlayer/playRawContent()
at runtime::ContentPlayer/playContent() ......

View 1 Replies

ActionScript 3.0 :: Passing Data From Document Class To Base Class?

Mar 1, 2011

I created a movieclip with a star. Then, I creates a document class and I named it as Main.as.

In that document class I wrote:
package
{
import flash.display.*;
public class Main extends MovieClip

[Code]....

I´m not posting here all the code, but you can easily see that I´m using x_origin and y_origin variables to keep the original position of the movie clip. I will use them to move the star back to the original position.
 
The problem is that instead of being 20 and 30 respectively, tracing them I see that they are both ZERO. So when I drop the star, instead of going to x=20,y=30 it moves back to x=0 and y=0. I´ve to get the star position relative to stage, but I can´t find anyway!

View 4 Replies

Flash :: Loader Class Problem Tracing The Swf (document Class)

Oct 12, 2010

I am using the Loader class to load 3 external swfs: sharedTopics.swf (does not have a document class) fonts.swf (document class is FontManager) main.swf (document class is Main) The same loader is used to load all 3 assets.

[Code]...

View 2 Replies

Actionscript 3 :: Stage Properties In Custom Class, Not Document Class?

Oct 14, 2011

I need to use stage.width/height in my CustomClass so I found some topics about it.

if (stage)
{
init(ar,firma,kontakt,oferta,naglowek,tekst,dane);

[code]......

View 1 Replies







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