ActionScript 3.0 :: Structuring A Preloader Class Around A Button Event

Apr 26, 2010

I'm putting together a portfolio site in the external method of using a document class structure.

Of the classes I have involved thus far include:

:: Master.as
and a
:: Intro.as

The Master class loads the Intro class (and others as well). The Intro class has the button event to trigger the Preloader. However, I want the button to trigger the Preloader as a separate class. Meaning, I don't want to build the entire function set inside the Intro class. I'm trying to build everything around the Master class and not go of in a tangent based around one event.

The problem I'm having is passing variable instance information in the Intro class to an external class whether it's a Preloader or otherwise.

I see tutorials for Preloaders, but how do people incorporate them into a pre-existing class structure? That is, in a modular fashion so I could re-use the Preloader class somewhere else? What's a common structure philosophy that's used to pass info?

View 0 Replies


Similar Posts:


ActionScript 2.0 :: Component, Class Or MovieClip - Structuring A Site?

Oct 20, 2005

I'm building an all Flash site, and trying to streamline my approach as much as possible. In the site, I have 3 main panes. Navigation, ContentText, and Slideshow.

I want to keep each of these areas self contained, and just call methods to make things happen. Something along these lines: slideshow.showImage, or navigation.loadData("nav.xml") or contentText.loadTextfile("about.txt").

I could make each pane a componant, or a movieClip with methods defined on the first frame, or perhaps I could use classes. I was hoping the more experienced people here might have some advice on what is the best approach to take.

View 8 Replies

ActionScript 3.0 :: Event Listener For The Button Class?

Feb 23, 2009

I'm trying to create an Event Listener used with all buttons placed on the stage rather than a listener for each button object.Are coding examples of a class listener?

View 5 Replies

Flex :: Button Event Listeners In Class?

Aug 4, 2009

I have many buttons in Main.mxml. I'm trying to move the button functionality into a Class and have Event Listeners inside the class respond to Click and call other functions. I have written:

Main.mxml
<mx:Button x="23.5" y="10" label="checker" click="{goListen()}" />
<mx:Button id="btnT1" x="252.5" y="10" label="t1" />

[code].....

View 2 Replies

ActionScript 3.0 :: Structuring A MovieClip Into Units That Are Loaded To A Different Time

Dec 16, 2009

itīs clear to me that I can load external SWF-Movies and other stuff like Bitmaps, Sounds etc. But how is it with the differentDisplayObejcts in the swf-root.
 
My specific problem: For a numerous mask-effected MovieClip-Field, the Constructor inside  an external class creates 3 Instances of different DisplayObjects in every loopcycle. First, the masked Object, then the mask (simply a black movieclip without code) and then, to seperate the masking from the Main-Class, a object container which contains the previously mentioned two Objects.
 
After creating the instances, they should brought into their Relationship on the DisplayList and added to Stage.
 
My Problem is: I think, the instancing of these many objects will take some time. Is there an Even-Listener and an Event, that checks if the Instancing was successfull and is ready be to displayed? Or do I have to create a boolean variable complete to my Constructor Funtion in the instanced object, that is set true after the end of the procedure? A loop in the Parent DisplayObject would check the value of the attribute and if it is set true, it will all add to the DisplayList and stage. Are there alternatives?

View 1 Replies

Actionscript 3 :: Add Event Listener In Custom Class Of A Button - Error 1061

Nov 10, 2011

Im getting an error whilst trying to add an event listener to a class of a Button on my stage.

1061: Call to a possibly undefined method addEventListener through a reference with static type Class.

On my stage i have a Button with the instance name stopBtn, this is also exported to an actionscript class called classes.stopBtn (stopBtn.as in a folder called 'classes'). The button is on the first keyframe in the main timeline, in a layer with other buttons on that layer

[Code]...

View 2 Replies

Actionscript 3 :: Structuring System Architecture In A Flex Web Application On A Budget (w/o Java)

May 28, 2010

I started a project a while back using the following architecture from Adobe Developer Article talking about Creating marketing platforms in Flex. I did my first set of coding locally forgetting that my server did not handle Tomcat. So I said okay, and cut some corners and then some other limitation came up and I cut some more corners. Eventually for a good week or two, it was trying to get the project working with making the ends meet. Layers started to merge.

In the end I used a

PureMVC (Presentation/Client) -> ZendAMF (Communication) -> MySql (Data) Layout.

It worked but I never felt as though I had some layer just to take care of all the SQL calls to the data.It just felt hacked together

So should I keep the above setup and just start from the presentation layer and move downwards like they said in the article or is there a better layering (based on a hosting plan that does not handle Java) I could accomplish ?

UPDATE: My current hosting plan - [URL]

View 1 Replies

Actionscript 3 :: Make A Preloader Class Instead Of Having It In The Document Class?

Nov 1, 2011

I have built a basic preloader that runs in my document class. I'm having trouble with it.I'm guessing its due to what a class can and can not access from the stage?theres 2 problems. the first is that I cant change the keyframe the stage is on from the class. the second is im getting an error 1009 if I comment that out.

package
{
import flash.display.MovieClip

[code]........

View 1 Replies

Actionscript 3 :: Why Are Event Types Typically Stored Within An Event's Class Definition

Dec 16, 2010

In all the ActionScript examples I come across, people write custom events with the types defined inside the custom event's class definition. But, in my experience, it makes more sense for the object dispatching an event to own its own definition of that event (which, in ActionScript 3, is a String).

[EDIT: After writing this question, I've found there to be cases for both positions -- in some situations, event types should be stored on the event object, and, in others, they should be stored on the object dispatching the event.]

View 2 Replies

Actionscript 3 :: Extends Event Class Without Keeping Any Existing Event Types?

Dec 20, 2011

I would like to extends the Event class to add some events I am using in game. But I don't want the new Event Class to have the old public static types. For instance I don't want to have:

NewEventClass.ENTER_FRAME

How do you go about extending the Event class without getting the old types mixed in?

Is there any way to outsmart AS3 to leave out the uneeded types?

Or should I avoid creating a new Event type altogether and just add the new strings?

View 1 Replies

ActionScript 2.0 :: MovieClipLoader Event - Getting OnloadComplete Event To Call A Method In The Main Body Of The Class

Apr 17, 2007

I'm newish to OOP AS... trying to build a image loader that wipes between loads. having trouble getting my onloadComplete event to call a method in the main body of the class. what am I missing?

[Code]...

View 1 Replies

ActionScript 3.0 :: Can Event Listeners Only Be Added To The Class Which Dispatched The Event

Sep 3, 2009

Can event listeners only be added to the class which dispatched the event? I ask because I want to have the logic for the listener on the main class, and the action is dispatched on click from a thumb which is instantiated in a scroller class. Kinda like this:

ActionScript Code:
pseudo code:
class main {
main() {

[code]....

This doesn't work. Why can't the main class listen for an event on the thumb class?

View 1 Replies

ActionScript 3.0 :: Add An Event Listener To An Event From A Custom Class?

Jan 7, 2010

how to add an event listener to an event from a custom class. Here are the relevent lines of code (I think) from the class:

[Code]....

View 1 Replies

ActionScript 2.0 :: Eating A Global Listener On The Class And Receive Dispatched Event For Any Instance Of The Class?

May 11, 2006

I've done a class to be able to listen to the event for a CLASS not on an instance.

Code:
class net.webbymx.events.XClassEventListener {[code]....

why did I do this.It cames with my rugby game.I have player in two teams. When a player throw the ball I want the other teammate to act like "wait for ball" and the opponent like "seek for ball". Plus I'm lazy (and I don't want to register the listener for each instance of the player I'm creating). So this class is made to be able to handle as many instance of a class I want without adding a listener on each of them. I'm just creating a global listener on the class and then I will be able to receive dispatched event for any instance of this class .so in my team I can do

Code:
XClassListener.initialize(this);
this.addEventListener("throw", "net.webbymx.game.Player", "wait");

and in my opponent team I can do

Code:
XClassListener.initialize(this);
this.addEventListener("throw", "net.webbymx.game.Player", "seek");

View 4 Replies

ActionScript 3.0 :: Dispatch Event From Class That Isn't Extended Class Of MovieClip?

Oct 20, 2009

Is it possible to dispatch event from class that isnt extended class of MovieClip? I created my own class and put import flash.events.Event; import flash.events.*; but when i call dispatchEvent compiler throws error:"1180: Call to a possibly undefined method dispatchEvent."

View 3 Replies

ActionScript 3.0 :: Listen For A Timer Event In Document Class From Another Class?

May 7, 2010

How do I listen for a timer event in my document class from another class? im thinking...... HTML Code:

[Code]...

HTML Code: 1119: Access of possibly undefined property gameTimer through a reference with static type Class.

View 3 Replies

Flash - Listener In Main Document Class For Custom Dispatch Event From Another Class Does Not Respond Or Call Function?

Apr 1, 2011

I have a document class called Main.as In the class constructor I have the following listener:

enter code here
var listeningFORModeChangeToStudent:Sprite = new Sprite;
listeningFORModeChangeToStudent.addEventListener(TellAllModeChangeToStudent.STUDENT,exp);
addChild(listeningFORModeChangeToStudent);

[code]....

In a third class I make a call to the despatcher in the previous class:

enter code here
var ThisTellAllModeChangeToStudent:TellAllModeChangeToStudent = new TellAllModeChangeToStudent;
ThisTellAllModeChangeToStudent.tellAllModeChangeToStudent();

I have trace statements in eveything and from this I know the despatcher in TellAllModeChangeToStudent is being called.The problem is that the listener in the main.as is not calling the function exp.I cant see why and I dont know how to check if the listener is actually seeing the dispatch event?

View 1 Replies

ActionScript 3.0 :: Dispatch Event In A Preloader?

Oct 9, 2009

dispatch an event on every 'onProgressEvent' of an external display object loading.

Does dispatching an event frequently cause performance issues?

All I want to do is have a parent class listen for whenever a progressEvent has fired in my loader class, rather than setting up an onEnterFrame loop in the parent class to call 'get' methods within the loader - this seems inefficient to me seeing as onProgressEvents don't occur on every frame.

View 2 Replies

Actionscript 3 :: Dispatch Custom Event From Class To Class

Apr 20, 2011

I want to dispatch a custom event from the Country() sto the MenuButton();[code]When a country is hovered a custom event is dispatched which I want the MenuButton to listen and if the parameter passed is the same as its name to get highlighted. The Country Class is the Base Class for my countries movieclips I have on stage and the MenuButton the Base Class for the menu button.

View 1 Replies

ActionScript 3.0 :: Dispatching Custom Event From One Class Over To Another Class?

Feb 18, 2009

In a nutshell I have a custom event that I am dispatching from one class that is not getting picked up by the other class even though i have added the appropriate addEventListener calls on its constructor.Here's how the classes are laid out:

application(class/parent)
- network(class/child)
- loginscreen(class/child)

The constructor of the Application class creates and stores references to the network and loginscreen classes:

ActionScript Code:
import com.fg.managers.NetworkManager;
import com.fg.screens.LoginScreen;[code].....

The NetworkManager class extends the MovieClip class as does the LoginScreen and Application classes as well.Now within the oLoginScreen class I dispatch the ValidateCredentialsEvent by calling it this way:

ActionScript Code:
dispatchEvent (new ValidateCredentialsEvent(ValidateCredentialsEvent.VALIDATE_CREDENTIALS, oLoginData, true, false));

Then when I debug the code, I can step through and see that the ValidateCredentialsEvent is being generated but it is never picked up by the oNetworkManager class whatsoever.Is this occuring because the NetworkManager and LoginScreen classes are children of the Application class and because of this can't capture events raised by one another without using the Application class as the intermediary to redispatch these events? My whole idea here was to create a generic network managing object that could be called from anywhere within the application, by any object, using custom events.

View 9 Replies

ActionScript 3.0 :: Flash Preloader Does Not AddChild On Event

Jun 1, 2011

I have a website file that I am preloading with an another swf preloader file. The code is on the first frame of preloader.swf and as follows:

Code:

import flash.display.Loader;
import flash.display.Sprite;
import flash.events.Event;

[Code]...

The problem is when I use this without simulate download option I see it is loaded via trace() and content.swf loads BUT when I use simulate download or upload files to Web and try it there it just counts to 100% percent and stops there.

View 2 Replies

ActionScript 3.0 :: Link The Button Event To The OnEnterFrame() Event?

Oct 29, 2009

When you click on a button and the animation is supposed to play foward or reverse based on which year the user is currently on and which they are selecting. Going forward is no problem However I don't know how to link the button event to the onEnterFrame() event so that when I use the prevFrame(), it will play in reverse at the same frame frequency as going foward. This is the code I have now.It goes back to the frame that it's supposed to, but the animation is not at the same speed as going forward. I goes back as fast as the code can loop.

function frm94to93 (event:Event):void{  while (currentLabel != "Frame1993"){  trace(currentFrame); prevFrame();  }

View 5 Replies

AS3 :: Tracing A Class Extended From The Event Class

Feb 18, 2011

I have created a class (extends the Event class) for use in one of my projects. If I trace the custom event object in the called function I get 'Event' as the type, but if I trace a TimerEvent, or MouseEvent, etc, I get TimerEvent or MouseEvent... Let me demonstrate:

var c:CustomObject = new CustomObject();
c.addEventListener(CustomEvent.ON_SEND_MESSAGE,fnc);
function fnc(e:CustomEvent) {

[Code].....

View 1 Replies

ActionScript 3.0 :: Event In Class / How To Identify In Another Class

Jul 14, 2009

I have a class (called Units) that defines sprites which react to mouse events (being dragged around).My main .as class (called Loader) imports the Units class, sets up several shapes from Units as objects into an array (my_array[i] = new Units(j,k,l);) and then calls addChild in a loop to add them to the display list (addChild(my_array[i].shape);).All fine and dandy, but if I want a shape to go to the top of the display list when dragged about, how do I do it? The problem is that the mouseEvent is in the Units.as class, but the addChild is in the Loader.as class.The only thing I can think of is to strip the mouseEvent out of Units.as and add it to Loader.as - but that would mean adding an event to every shape in a loop, which seems inefficient.

View 1 Replies

ActionScript 3.0 :: Create Custom Event Class If I Dont Need To Pass Custom Property With That Event?

Dec 28, 2009

Is there a point of creating custom event class if i dont need to pass custom property with that event?

View 3 Replies

ActionScript 3.0 :: Preloader For SWF In Document Class

Jul 15, 2009

I am making a website where one main swf loads several other swf components into it, and the first step is for the loadbar swf to be loaded in.

Code:
package{
import flash.display.MovieClip;
import flash.events.*;
import flash.display.Loader;
import flash.net.URLRequest;
public class MainClass extends MovieClip {
[Code] .....

I am getting the following errors:
Location:
MainClass.as, Line 3
Description:
1046: Type was not found or was not a compile-time constant: loadBar.
Source:
import flash.display.MovieClip;

Location:
MainClass.as, Line 13
Description:
1120: Access of undefined property loadbar.
Source:
loadbar.contentLoaderInfo.addEventListener(Event.C OMPLETE, addLoadBar);

loadBar_mc is an empty movie clip on the main.fla stage which I am using just to position the loadbar.

View 1 Replies

How To Get Preloader To Work Inside Class

Nov 6, 2009

I am very new to flash and on the net I've found a class that allows me to use a nice scroll bar for the content. My problem is that I can't get a preloader working with the class. When I want to add scrips to the frames it bugs the class if I try to implement the preloader inside the class I can't get it working. Here's the class I am using for the scroll bar. - if you want to test it, it will require additional data. You can get it all here: [URL].

package{
import flash.display.*;
import flash.text.*;
import flash.events.*;
import gs.TweenLite;
import com.warmforestflash.ui.FullScreenScrollBar;
public class Main extends Sprite{
[Code] .....

If I try to insert the preloader script inside the class it has problems with the stop(); & play(); commands. Any way to get a preferably simple preloader working with the class I am using?

View 1 Replies

ActionScript 3.0 :: Preloader For A Swf With Document Class?

Oct 30, 2011

I have created 1,5mb swf file and I need preloader for it. I don't have any timeline code in it. All written in OOP, based on document class. I grabbed a preloader from my previous projects but this one doesn't work. The output is: "TypeError: Error #1009: Cannot access a property or method of a null object reference at myDocumentClass()"Basically I want to load large swf in my preloader swf or whatever will work. I tried add loaderInfo to my document class but complete event triggered only when everything is loaded, and nothing appear before that. Just a blank screen.

View 15 Replies

ActionScript 3.0 :: Preloader Class In External .as File

Mar 27, 2010

I'm trying to wrap my head around AS3 and it isn't going well. I'm getting stuck on the most basic of problems it's making me pretty angry. I'm trying to do something as simple as reference the stage and I just can't figure it out; something that usually takes me seconds has eaten up 2 days of my time.

I have a Main.fla that outputs Main.swf; it contains no script, only library assets. I have a document class set up using Main.as, which itself has 1 trace and code to run the Preloader class, which is held in Preloader.as.

[Code]...

View 8 Replies

ActionScript 3.0 :: Loader Class - How To Add Custom Preloader

Feb 11, 2011

I have a loader which loads on a MouseEvent.Click. It uses this for multiple swfs
Actionscript Code:
myLoader.load(new URLRequest(event.target.name + ".swf"));
How can I add a custom preloader to this?

View 5 Replies







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