Flex :: Querying The State Of A Class's Listener?
Dec 13, 2009
I have instantiated a class (class1) that loads some data via PHP in an AS3 Flex project.I instantiate class1, which is asynchronous and utilizes a URLLoader() to obtain its data.Then I would like to instantiate class2, which needs to USE the data from class1, but when I simply instantiate it I find that class1's instance variable is not populated yet because I am calling class2 too quickly.How can I create such a dependency that will link correctly?I am really new to using listeners, but I am imagining a listener in class2 might be what I need?Or maybe I can pass a reference to the listener in class1 into class2?I also know nothing about dispatching events... is this the key?Here's an example in pseudo code:
var class1:myC1 = new myC1("http://some/url/to/utilize");
//this never shows up because it hasn't loaded at the time i request it
trace("the stuff from class1 is: ", class1.myXMLList);
[code]....
View 2 Replies
Similar Posts:
Dec 13, 2010
I have been struggling with trying to interface with SQLite and Adobe AIR. I am using the Flex 4 SDK with AIR 2.0. I modified code from a tutorial by David Tucker on InsideRIA ([URL]). I am writing in FlashDevelop (which I suppose could be my problem), and I can compile and run the app. The issue is that when I go to search the db file, I always get some error which results in the 'BREAKER' trace (ie - the 'queryError' function is called). I have tried simply running the SQL command on the db and it works fine, so there is an issue somewhere in the way Flex or AIR is handling my query (or obviously I could have made a mistake in coding).
[Code]....
View 1 Replies
Jul 12, 2011
I'm trying to find out what the time is through a Date var and changing the hours in it.Does anyone know how to do that? I guess in pseudo-code i would like something like this:
function updateTime(d:Date)Void
{
Var nowTime:Date() = new Date();
[code].....
View 1 Replies
Jan 12, 2011
I have a VideoDisplay instance playing some video. When I click on the video slider (also my component) the property videoDisplay.playheadTime is set and the videoDisplay.state goes from 'playing' into a 'seeking' state for a brief moment (the videoDisplay seeks for a new position and then plays the video again). Intended bevaiour. But if I'm (or any random user) fast enough, I can set the playheadTime again while the player is still in 'seeking' state. When repeated several times every click is enqueued and the videoDisplay jump on every place of the video I have clicked(this is happening in an interval about 10-15 second after my last click). When I use live dragging the videoDisplay, overwhelmed by seekings, goes into 'error' state.My question is - is there any way to cancel seeking state of the VideoDisplay class? For example player is in 'seeking' state, I set playheadTime, and the player forgets about last seeking and try to find the new place of the video.
View 1 Replies
Jul 18, 2011
let's say that i have this button which is called "Click_Here" and i added an event listener to it in some class file in order for it to run the event handler in a different one .. so it will be like this
classfile1.as
Click_Here.addEventListner(MouseEvent.CLICK , buttonClicked ) ;
classfile2.as
public function buttonClicked (e:MouseEvent){ trace ("hello");}
View 3 Replies
Oct 22, 2011
I am looking for a way to trigger the downState of my SimpleButton using my KEY_DOWN event. I am hoping there is a way to do this without having to switch this to a MovieClip custom button.
[Code]...
The actionButton is my SimpleButton. I have tried dispatcing the CLICK event and MOUSE_DOWN event but neither has worked.
View 1 Replies
Aug 2, 2011
I have only set up an event listener Mouse Input and Keyboard input. How do I set up an event listener for a Boolean's state? I change the Boolean state in other classes using:
main(parent).meVariable == true;
So, how do I set up an event listener in main to jump to a function if that turns to true? something like...
ActionScript Code:
if (myVariable == true){
myFunction();
}
View 2 Replies
Apr 9, 2011
It's my understanding that view states can be useful when switching the layout of design elements. Such as, a loading page as one state and the main application design in another state. Is this the correct use of them? Additionally, I have a label in State1 and I cannot figure out how to access that label via actionscript. labelID.text = "New Text"; is not working.
View 2 Replies
Mar 30, 2012
I'm using Flex 4.5 and trying to take advantage of the new state groups feature. I have two States (call them readType1 and readType2) that both belong to the same stateGroup (call it readOnly). There are several places where I'd like to do something based on the current state, and it would be the same thing for the two read states. [code]...
View 1 Replies
Jul 25, 2009
In my air project i used current state size is width="441" height="358" . i have link button like Singin then move to singin state (currentstate='singin')
<mx:State name="signin">
<mx:SetProperty name="height" value="616"/>
<mx:SetProperty name="width" value="919"/>
So application resize into 616,919 . After that function finished move to current state like(currentstate='') But size not be changed . How can i set the size for current state?
View 1 Replies
Jan 27, 2010
I want to fade all the elements of the next state when transitioning from any state.I tried different things but I can't get it to work. And I don't want to manually add transitions for every state.
Something like:
<s:Transition fromState="*" toState="*">
<s:Fade target="*" duration="500" />
</s:Transition>
View 2 Replies
Mar 25, 2010
In my view I have a welcome screen:
[Code]...
Which is a pretty small component and I have panelContainer:
[Code]...
Whilst the user is reading the warm and fuzzy welcome note in the welcome state I want to be creating the big expensive panels state so taht when we switch there is no delay. Before the panels state is set panelView is null but I presume there must be an IDefferredInstance floating around somewhere that I can use to kick off the creation of the view. How can I get hold of it?
View 1 Replies
Sep 3, 2011
i curious how to access state in flex "Current State" from flash movie clip??..so far i make movie clip in flash and it has button inside with name " button" and i put this flash file into flex in "state 1" flex application..i want to make event handler for "button" that trigger changing state from "state 1" to "state 2" in flex application..and in flex application i do not write anything because i have no idea how to deal with this stuff..
View 1 Replies
Jul 5, 2010
Is anyone aware of a clever way to query (in AS3) an .xml file so that when the .xml file changes (as the result of an Access query in this case) the AS3 application (Google Maps API) refreshes using the new .xml data?
View 3 Replies
Apr 13, 2011
trying to create an AS3 script in order to use an ASP page which can connect and get data from a MS SQL Server 2008 database.I only need to check one DB entry, from my Flash SWF, to see if a user is already registered in a companion Learner Management System (LMS). If the user has already registered, the LMS would have sent his/her name to the MS SQL database (can not be re-configured to write to MySQL, which would be easier using PHP). So, I would need to user middleware like ASP so that the Flash AS3 can call the middleware script which can query the DB.
I found a good ASP script for setting up a MS SQL DB query at:[URL] (without DSN version). (I would need to add some way in this ASP page to get an array of registered users' name returned.)The help I need is with the AS3 in the Flash SWF that can call the ASP page and get back the user name. Then a check (with user input of their name in a dynamic text box):if it is in the returned DB table array, then 'thank you for registering.' And the registered user can proceed to frame 2. If not, 'please register using the LMS at [URL] like that.
View 2 Replies
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
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
Feb 17, 2006
I have used this navigation script several times in regular flash coding without problems (as in functions). Now I'm trying to put this code in a class for easier usage in future projects.Concept of the code is that I pass the instance of the mc in an variable so that I have an old and new location for enabling and disabling a "ON" state in an mc (vars : OldLocation && NewLocation).This is pretty basic stuff but I can't get it to work inside a class..Offcourse at the first click you will get an undefined because of no instance defined yet (I define it in the fla file).[code]
View 2 Replies
Nov 29, 2010
I'm making an app with pages set out as classes which extend the MovieClip class.
What I've got are back buttons and different pages which go to the same page, however... If I end up going out of a page and back into a page (specifically one with drawn squares and dynamic text boxes called from a web service), it seems to have kept all of the original information.
So far I've tried killing all of the children with a while loop targeting the index and also using weak event listeners - neither is working!
View 2 Replies
Aug 31, 2009
i am trying to define a button state class where i can give the class some params and have it load a thumbnail (large files were a previous problem for me on this) that will be displayed upon rollOver. i'm having some troubles with a couple of key points:
1. i don't know how to pass in a reference to a movieClip that i can refer to in order to change its state (x location, for example) 2. i don't know how to send a status message to the host script (main timeline AS code will need to deal with such a message) after the img has been loaded
*both of these would REALLY help me understand some of the mechanics involved with AS2 OO programming,
[Code]...
View 9 Replies
Jan 6, 2006
How do I implement a listener within a class? I am instantiating other objects within side of another class. A sorta parent and child thing. How do I go about making the parent class subscribe to the child class. I want to leave all of the coding at a class level and keep it off of the main timeline.
View 5 Replies
May 12, 2009
I have a flash map that contains 51 movieClips, one for each state.Sample instanceName for a state (Alabama) would be: S_01
I have a XML record that contains specific info for each state.<stateID>01</stateID
I am trying to link the stateID's in the XML record to the state movieClips that make up the map.var stateInstanceName = 'S_' + stateID;
I was just trying to do a simple trace command to see if I could pull the _width of each state clip to see if I was linked up:
trace(mapInstance.stateInstanceName._width)
View 7 Replies
Apr 14, 2011
I need to add a rollover effect to the disabled state of a Spark button. This way, users can rollover the button and know why the button is disabled.I think I would have to override ButtonBase's getCurrentSkinState. Is there anyway to test if a mouse cursor is over a disabled button?
View 1 Replies
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
Dec 15, 2009
I want to a listener on a tween on the document class that when it's finished, it goes to it's child's listener function, but I don't know how. I thought it'd just be a case of document.functionName but it's throwing an error.
[Code]...
1061: Call to a possibly undefined method startFade through a reference with static type Class.
View 3 Replies
Feb 16, 2011
Im tring to remake most of my projects that i've created so far in class's and packages but it seems to be a mission.
I have the gameMain_Controls class which is the linkaged to the actually fla.
then i have a custom cursor class and a char class the gameMain_Controls pulls objects into the stage as children of the background fron the char class.
now my problem is to get the cursor to hittest of mouse over and at least do a trace out put:
code im trying at the moment which is also in a different class ...called the rollOver_Controls:
if (flap_Control.flap.hitTestObject(Dino_Control.layla))
{
trace("lal hit");
}
[Code]....
but the hittest jsut never occurs im guessing the problem is which the location of the object, the container i mean ...but when i try to link it that way i get even more problems
View 6 Replies
Nov 20, 2011
i have a custom class which loads a couple of XMLs. i am creating an instance of this class within another class and i need to know when it is done loading in that parent class so that i can then call a function.
View 3 Replies
Apr 7, 2012
For graphical representation I use fla file as a resource. I work in Flash Builder 4.6 to code. I try to create own class Panel which contains the click event. But event doesn't work when I test the move! When I move the event handler (buttonClick) and event listener to main class (test) and apply the event to the card object (for example), all works fine.
[Code]...
View 1 Replies
Oct 10, 2011
I was trying to make a tank game in which I can move the tanks, let them shoot each other, etc... I insist on creating external classes with Flash Pro cause I am used to OOP language like Java. I created a Tank class which represents all the tanks. Here is the code of this class:
[Code]...
The problem is that the action listener seems never get called when I press any keys. the trace() is not called. But I tried to add a mouse listener just to test and it worked. So I guess its the Keyboard event listener class's problem? Everyone I see on the web uses stage.addEventListener(KeyboardEvent.KEY_DOWN, move) approach.
View 1 Replies
Aug 25, 2009
I'm trying to add an eventListener to a custom class. I created a motion tween in CS4 and exported the motion as as3, which then gave me a chunk of code.I then took that code and turned it into a class. What I'd like to be able to do is set up an event listener in my FLA to listen for when this animation is done playing, however, I have been unable to get that to work. Do I need to add something else to my class? Is there something wrong with how I'm trying to implement the class in my FLA?Here's the code for the class:
Code:
package
{
[code].....
View 4 Replies