Actionscript 3 :: Updating A Var And Firing A Function With It On Creationcomplete?

Dec 7, 2011

I'm having trouble with updating a var and firing a function with it on creationcomplete.In the main component i declared a var artist. This var certainly works and has a value. I also need that var in another component: a profile component. I am able to get that var with:

newVar = Maincomp(this.parentApplication).artist;

I use the newVar in an API in the profile component. When i launch the API function with a mouseEvent, it works. However, i want to launch the API function on creationComplete and than the var doesn't work: it returns Null. I hoped that making all the involved vars bindable would help, but it doesn't. Extra code to make my case clearer:In main comp:

public function handleclick(cName:String):void
{
vName = "aVariableIGetFromAnAPI";[code]...

This code works, but point is that this code works if i call it with a MouseEvent, but doesn't when it needs to launch on creationcomplete. Or well, it returns Null instead of a value. I thought that making the involved vars bindable would fix it, but it doesn't.

View 1 Replies


Similar Posts:


ActionScript 3.0 :: Get The CreationComplete Function?

Feb 22, 2010

How to I get the creationComplete function so that I can safely access swf objects? I thought going to the parent of all (the stage?) would work..I have tried unsuccesfullly to use :

stage.addEventListener(Event.COMPLETE, myCheckComplete);

but am having problems.

View 4 Replies

Flex :: LoaderInfo Null Inside CreationComplete Handler Function?

Apr 30, 2010

I've coded this small snippet to show what I'm not understanding:

[Code]...

Shouldn't I be able to read loaderInfo inside the creationComplete handler? I'm trying to pass a string from the html to my flash component, that's why I have to get loaderInfo working.

View 1 Replies

Flash :: Flex - Registering A Function As Callback Using CreationComplete Event Fail On Linux?

Jan 13, 2011

I have created a flex project on flash builder 4. In the MXML I have

xmlns:mx="library://ns.adobe.com/flex/mx" creationComplete="init();"

And to check if it runs

[Code]...

View 2 Replies

ActionScript 2.0 :: OnPress That Keeps Firing A Function?

Feb 16, 2009

I was wondering for personal use how you would go about writing a function on a button that when the mouse click is down it would keep firing the function kinda like it does when using the onEnterFrame on key frame..

View 2 Replies

ActionScript 2.0 :: Function Not Updating Text Field & Variable

Jan 12, 2009

I have a function that is suppose to update a variable which updates a textfield and it is not working.

[Code]...

View 0 Replies

Actionscript 3 :: TileList CreationComplete In Adobe Flex 3.0

Jul 3, 2010

I have made a tile list is Adobe Flex as follows

[Code]...

the problem is the creationComplete event is not fired for each PageImageRenderer, and it is fired only for the tiles visible at start so the rectangles drawn in initComponents() is only drawn for those tiles with valid values, and when I scroll to next row using scrollToIndex() function the rectangles are shown with previous values. and no initComponents() is called for these tiles? however the data.name, data.class are correctly displayed but not the rectangles, why it is so? What is the proper event against which I should call initComponents()?

View 1 Replies

Flex :: 4 AddElement Or Something Wrong With CreationComplete Event?

Aug 19, 2010

I am using the new Flex4 Spark stuff but I'm stuck at an awful problem. Let me explain a bit of the situation first. I have a container (mx:Canvas) in which I do addElement() of one type instances (DocumentWindow). The document window class is supposed to be the holder for a view according to the type of the document. The DocumentWindow class extends TitleWindow. I also have a task bar which is a mx:Canvas with buttonBar inside so that the windows should be switchable. So in 2 words I got windows holder and a taskbar. The strange thing comes now: When I put a DocumentWindow with type "doc" (which loads swf made by swftools) the window appears in the windows holder and as task on the taskbar.

But if first I open something else - DocumentWindow with type audio or video which causes the DocumentWindow to instantiate different view inside, the window doesn't appear on the screen neither a task button is being shown in the taskBar. I put a trace() on that and it shows that numElements is increasing, the taskBar ButtonBar.dataProvider.length is increased, so the things are there - just that they stay invisible until I open DocumentWindow with type 'doc'? I even tried to make DocumentWindow not to load the view inside because I thought that the only difference is the view... but then even the 'doc' typed DocumentWindow didn't show. A clue may be that creationComplete is never called until a 'doc' view is added.

[Code]...

View 1 Replies

Flex :: Performance - Six Seconds Between Initialize And CreationComplete

Apr 4, 2011

I'm working with a large flex applications and I have noticed that one of our largest components (with lots of child canvases) takes about 6 seconds between the initialize and creationComplete events. I've been doing some reading and have found that having lots of nested canvases can cause slowdowns, but i'm not sure if this is where the slowdowns would be?

View 3 Replies

Flex :: Difference Between CreationComplete And ApplicationComplete Event?

May 16, 2011

I didn't get the difference between those two event.What is the difference between them ?

View 3 Replies

Actionscript 3 :: Flex Instantiated Object / Wait For CreationComplete

Nov 12, 2009

I have a simple component I created which I instantiate in my main program like so:[code]I receive the error "Cannot access a property or method of a null object reference" on the second line because newMessage was not fully created prior to hitting the second line of code trying to set my "body" textarea's text. I know I can build a "creationComplete" event handler, but isn't there a simpler way to do this?

View 2 Replies

Actionscript 3 :: CreationComplete Only Works When The Screen Is Visited For The First Time?

Jan 27, 2011

I know the event "show" works for View stack i.e. I can use this event (capture it and do some processing) to know whenever my view stack child gets displayed in screen. But when I am trying to use the same event for a child of a state it doesn't work (i.e. breakpoint set at its event handler never gets hit). Similary, creationComplete only works when the screen is visited for the first time.

View 1 Replies

Flex :: Events - 4 States IncludeIn And Component CreationComplete?

Feb 2, 2011

I have a component that, once it's all ready, I need to set the state based on a variable I'm reading in from XML. I tried doing it with creationComplete, but it's apparently not ready, as the state isn't being set with elements rendering properly, but the states & rendering work fine if I do a subsequent state change with a click action on some element.

What should I do in this situation to make sure the state gets set at the right time & elements that should appear due to includeIn exist so they can be rendered? initialize instead of creationComplete doesn't seem to do the trick for the first time the component is created. Any successive calls to the component are fine.

View 3 Replies

Flex :: Initialize Some Variables After CreationComplete Event Is Dispatched?

Mar 7, 2011

I tried to send some services to fetch data in the creationComplete handler. Then I need to process the server raw data before displaying some sub components. Where should I put these kind of code?

View 2 Replies

Android :: Sequence For CreationComplete, Activate, ViewActivate And AddedToStage?

Dec 22, 2011

I am the freshman for flex and actionscript. I want to know when a mobile app initiates, what is the sequence for calling these methods and what are actually they doing separately. I am confused about these functions: creationComplete, activate, viewActivate and addedToStage for begining the app and deactivate and ViewDeactivate for closing the app.

[Code]...

View 1 Replies

Flex :: Initialize() Or CreationComplete() Method Not Invoked When Revisiting The Page?

Dec 17, 2010

In my flex application I use the viewstack.selectedchild() property to change the views.

When I revisit the views by the viewstack.selectedchild() property the initialize method doesnot get invoked..

View 5 Replies

ActionScript 3 :: CreationComplete Event Does Not Show Correct Height / Width

Apr 27, 2011

I have an issue where using MXML, the height and width properties of myBox is correctly acquired but using ActionScript the correct height and width acquired is not correct.

my:Tab extends NavigatorContent (This is NOT the tab in a Tab Bar)
com:myBox extends BorderContainer.
<mx:ViewStack id="viewstack_main" width="100%" height="100%" creationPolicy="all">
<my:Tab label="My Tab">
<s:Scroller height="100%" width="100%">
[Code] .....

In the constructor of myBox I set the percentWidth and percentHeight to both 100. In the creationComplete event of the same myBox, I need to access the height and width. This works all ok with the MXML. However using ActionScript I need to add another tab.

var navContainer:Tab = new Tab();
viewstack_main.addElement(navContainer);
var scroller:Scroller = new Scroller();
scroller.percentHeight = 100;
scroller.percentWidth = 100;
[Code] .....

But unfortunately, in the creationComplete event of box, the height and width properties are NOT what is expected (the height & width after setting 100%). It is 112. Why this works with MXML but NOT ActionScript?

View 2 Replies

Flex :: Setting Spark DataGrid Column's Default Sort On Application's CreationComplete

Sep 8, 2011

I have a spark DataGrid component with several columns and I want to have my application default to descending order on the first column in the DataGrid. I would like to use the built-in default sort that occurs when clicking the top header once. I have no need to sort the ArrayCollection I'm working with or change what the comparators are.I also want any user-generated sorting such as clicking on a different column's header to override the default sorting.

View 1 Replies

Actionscript 3 :: Make Input Text Control Ready For Input On CreationComplete In Flex/MXML?

Mar 19, 2012

I have the following Application tag code in my widget:

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:local="*"
width="100%" height="100%" minWidth="200" minHeight="200" layout="absolute"
creationComplete="init()"
defaultButton="{Send_btn}">

[Code]...

View 1 Replies

Flex :: Flex CreationComplete() Not Executing For Certain Machines

Jul 26, 2011

I have a creationComplete="myMethod(event)" in my s:Application, and it runs fine on my 3 flex (Flash Builder 4) development machines. However it is not working on the 2 end user machines I tried it on today!

It is not executing the creationComplete at all, but it is running the application and it seems like all the other code is running fine - with the exception of possibly some other creationComplete code for other components in the app.

On my machines I have tested it under IE 8 and 9, FireFox and Chrome - on all 3 machines.

On these two machines it has the problem on both IE 7 and IE 8. I even installed FireFox new and it also has the issue. After installing the latest flash player and deleting all browser history/cookies it still has the problem.

What might cause the creationComplete to not execute?

Update: I tried using initialize() and no difference.

However, I believe I found the line of code causing the problem:

var isDebug:Boolean = new Error().getStackTrace().search(/:[0-9]+]$/m) > -1;

If I comment that out, it works fine. I need that to know if my app is running in development/debug mode or on an end users machine.

View 2 Replies

ActionScript 3.0 :: Why Isn't This Timer Firing

Oct 4, 2010

here's the code.
 
var zipTimer:Timer = new Timer(1000, zipArray.length-1);
zipTimer.addEventListener(TimerEvent.TIMER, onTick);
zipTimer.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete);

[code]....
 
Now, I can't see, for the life of me, why this isn't firing. It's almost exactly the code from Adobe's docs...zipArray.length is at least 32.

View 1 Replies

ActionScript 3.0 :: HitTestObject Firing More Than Once

Dec 15, 2011

I'm working on a scene where the user can drag sugar, honey and syrup flavour to a cup of coffee and each time they collide, the coffee's happiness is increased by 1. I added a TweenLite so that sending any of the objects to their original positions is much more fluid. The problem is that the hitTestObject is now firing more than once (which makes sense and now happiness is increasing at more than one increment at a time) but how can I make it so happiness is increased just once?

Code:
public function hitsDecaf(e:Event):void{
if (myCounter.myHoney.hitTestObject(myCounter.decafSweetened)){
ifStartTimer = true;
stopDrag();
myCounter.steamHappy.gotoAndPlay(2);
[Code] .....

View 4 Replies

ActionScript 3.0 :: FullscreenEvent Not Firing?

Jan 24, 2008

I have the following:A document class, extending from a custom class, extending from MovieClip. In my document class, I assign a handler to the FullScreenEvent like so:

Code:
addEventListener(FullScreenEvent.FULL_SCREEN, function(e) { toggle_fullscreen(); });

Also, I've set up a SimpleButton to call that same function, toggle_fullscreen, when clicked.Here's the catch:When I click the button, my app goes fullscreen. When I press Esc, the app goes back to normal but the FullScreenEvent doesn't get fired,so I can't catch it to re-align the elements on my stage.I've also tried to add the event listener to the stage object of my document class, but that doesn't work either.

View 4 Replies

ActionScript 3.0 :: KEY_UP Not Always Firing?

Sep 20, 2010

The problem is that I've done a lot of work in my game, and there's too much code bound to shift and control keys. For example you need to hold shift key to select multiple soldiers or control key to shoot or sometimes pause the game or even call a map, a lot of stuff in GUI depends on those keys as well. Both KEY_UP and KEY_DOWN are added to the stage object. But, time after time, there happens a very annoying thing, KEY_UP event just doesn't fire for shift or control (in most cases it does, but not always). That is, I press shift, start selecting soldiers, then release shift but Flash Player keeps thinking it's still pressed, so I can still select multiple soldiers, which is not good.

I found the exact same problem here: [URL]

View 6 Replies

ActionScript 3.0 :: Event.ID3 Firing Twice Instead Of Once?

Jan 19, 2010

I have some code where an event handler listening to Event.ID3 fires twice for an MP3 file. From searching the web, I found a few others asking a similar question, but I haven't seen any response.

Does anybody know what would cause the ID3 Event to fire twice for a single file? My only guess is that the MP3 file contains two versions of ID3 format.

The code looks like this:

Code:

var mySound:Sound;
function setup()
{

[Code]...

View 2 Replies

ActionScript 3.0 :: URLLoader Only Firing At 100%??

Feb 14, 2010

I am having a problem with my ProgressEvent.PROGRESS handler. It looks like this:

Code:
function handleProgress( event:ProgressEvent ):void {
var percent:Number = Math.round( event.bytesLoaded / event.bytesTotal * 100 );
trace("Uploading %" + percent);
}

It just traces "Uploading %100" every time

I am using a big file so I know its taking several seconds between calling URLLoader.load and complete. There just doesn't seem to be a report in between 0-100..

View 12 Replies

ActionScript 3.0 :: Events Firing Before Listener Is Set

Nov 18, 2009

I keep running into problems where I want to add an event listener onto a class instance RIGHT after it's instantiated, like this:
Code:
storiesXML = new XML(XMLdata);
storyBook = new vStories(XML(storiesXML.stories));
storyBook.addEventListener("storyBookLoaded", storyBookLoaded);
. . .

But by the time we arrive at the third line, the "storyBookLoaded" event has very often (inconsistent) already been dispatched from my class instance:
Code:
var evt:Event = new Event("storyBookLoaded", true, false);
dispatchEvent( evt );
...

(Even though quite a lot has happened in the class before that.) To be clear, I don't want to add storyBook as a display child, and even if I did, the addChild() method would have to be called after instantiation of storyBook, so we'd have the same problem. I know I could set a timer in the vStories class to artificially delay the dispatching of the event, but that seems really hack-ish, and would have a real compounding problem if I have to do it too often as everything builds up. How to make sure custom communication events happen after their listeners are set?

View 4 Replies

ActionScript 3.0 :: Timer Event Not Firing?

Jul 13, 2010

I have a little flash app that I have running constantly on my server (I made it an exe). It runs great for a few days, but then eventually it just stops.

Code:
trace("test1");
var myTimer:Timer = new Timer(5000, 1);
myTimer.addEventListener(TimerEvent.TIMER, getData,false,0,true);

[Code].....

The code above should call the function getData once after 5 seconds have passed. This works 99.99% of the time, but for some reason (usually after a few days of it running) it doesn't call the getData function.

I have verified this through trace statements. When it eventually fails, it traces out test1, test2..... then nothing else. No test3.

I'm assuming I need to add an event listener for the timer object to check if it fails for whatever reason. How do I do this?

View 4 Replies

ActionScript 3.0 :: Event.COMPLETE Isn't Firing

Sep 21, 2009

Can anyone see why my event.Complete isn't firing

[Code]...

View 4 Replies

ActionScript 3.0 :: Event.COMPLETE Not Firing On PNG?

Dec 5, 2009

I'm sure some users on this forum will be aware that AddThis are dropping the Clearspring Launchpad, so I'm writing a new API to get ready for the changeover. Part of that is a base UI that will create buttons for social network sharing destinations. At the moment, AddThis contain all the icons in a single long strip that is 16x3520 pixels in size [URL]...
 
What I'm trying to do is load this into a utility class, but the Event.COMPLETE event never fires, and if the Loader class that loads it is added to the stage, the bitmap is never shown. I thought it was maybe a dimensions issue, but what is curious is that if I place the PNG on a Flash stage and export as a SWF, it loads no problem. If I dump it out as a JPEG, no problem. Its ONLY when the file is a PNG that there are problems trying to load it. I even tried dropping it out as a 24-bit PNG (the original is 8) but that had no effect.

View 2 Replies







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