Actionscript 3 :: What Is The Complementary Event Of 'show' For Flex Displayobjects

Jul 12, 2011

Since flex memory management is poor, objects once instantiated dont die very easily (even when they go out of scope), one would need to check on various properties of components. I am using one such thing to know if the screen (which is a display object) is in current view. For this I am turning on a boolean property (currently visible), and I am setting it true on show event of the display object.

What I need to know is, which event (something opposite of show, e.g left?) could be used when the screen is replaced by another display object?

Something like focusIn and focusOut from dotnet.

Or if there is some property which could directly tell me if the display object is currently in view (hasFocus doesnt seem to be giving me expected results).

View 2 Replies


Similar Posts:


Flex :: Removing Flex DisplayObjects From View AND Memory Pool

Feb 15, 2011

There is a Flex app with 7 main views. And there is a memory issue when navigating between views.All these views were in a ViewStack, but due to some involving 3D objects I assumed it was too much to have it all in the display list. I'm now clearing all children from the stack and adding/removing them when needed. This gave a small performance increase, but still becomes unresponsive with use. The strange thing is, with this and the original method, the CPU climbs with use but eventually levels out somewhere. Now I'm creating new instances of each screen when they are navigated to and setting the previous variable to null. Now it looks like CPU is spiking when the view is created, but leveling out to something much much lower than it was. This felt like progress, but now the available memory keeps climbing where it wasn't before....

My understanding was calling remove child or remove all children would mark the object for deletion when the garbage collector next ran. I can't see any other references to the instance. My code is along the lines of [code]I have a function for each button to add a new instance like the above.The only thing I can see and feel silly asking but need confirmation, is each view extends a class called "Screen", this class contains a singleton reference to some core components.[code]Would this trick the garbage collector into thinking it was still needed? General advice on clearing Objects from the memory pool would awesome!!! I've never needed to analyze the Flash Player in such depth.I think it's an error with sound drivers, removing all sound and shes purring like a kitten. Works on my machine fine with windows XP, but not on the touch pad the application is crashing on with windows 7 (unsure of the drivers looking into them now) Now I'm thinking its not the drivers, tried 3 different versions, all with no improvement. I did discover the sound was fading in and out with the TweenLite lib. Doesn't look like there are any memory leaks in TweenLite as it works fine on other machines. Just the use of volumeEasingFunction seems to consume increasing amounts of CPU until it freaks out. It is crappy hardware running windows 7, which doesn't help.

View 1 Replies

Flex :: Mx:Canvas 's Show Event Equivalent In S:Group

Feb 5, 2011

As of Flex 4, I'm using s:Group instead of mx:Canvas.

With s:Group , show event is not fired when the container is visible like with mx:Canvas. creationComplete event fire only once. How can I detect show event or something alike in Flex 4 or should I just use the mx:Canvas instead ?

View 1 Replies

Flex :: Adding Dynamic DisplayObjects To Canvas

Jan 5, 2010

I am adding DisplayObjects to a Canvas using
ContentContainer.addChild(c);
Where ContentContainer is my Canvas object and c is the DisplayObject I have created at run-time. Some of these DisplayObjects also have children of there own which are added at run-time prior to the DisplayObject being added to the Canvas.

I then need to iterate over all the children of ContentContainer but the first time I do this, it says that ContentContainer has no children (i.e., ContentContainer.numChildren = 0). If I do it again tho then it is fine and returns the correct number of children. Is there something I need to call to get ContentContainer to recalculate how many children it has?

View 2 Replies

Flex :: 3 - Invalidation In Show Event Handler Breaks Lifecycle

Oct 20, 2011

Create a tab navigator (or viewstack, whatever) and add a couple tabs. On your tab add a show event handler. Inside the event handler call invalidateProperties() and invalidateDisplayList() on one of the children of your tab. Put a break point on the childs commitProperties() and updateDisplayList(). You'll notice that the updateDisplayList() gets called before commitProperties() which results in incorrect behaviour.

I noticed this problem when setting a DataGrid's dataprovider from inside the show handler. Setting the dataProvider causes the grid to invalidate both properties and displayList, updateDisplayList() will get called first, then commitProperties() which will result in the grid not updating the rows. It appears the root of the problem is that the show event gets dispatched from within LayoutManagers validateDisplayList() loop, so invalidating a child object from within the show handler results in its updateDisplayList() getting called immediately.

[Code]....

View 1 Replies

Flex :: Tabnavigator - Hide Some Tabs In Tab Navigator And Show Them Only When Certain Event Occurs

Sep 20, 2010

I am using tab navigator. And it has thee tabs "Search", "Show as text", "Show on map" I have a address search box in Search tab. I would like to hide other two tabs if search has not happened yet. So if user hasn't searched any thing other two tabs shouldn't be visible.

View 1 Replies

Flash - Calculate Mono/Complementary/Triadic/Analogous From Specific Color

Mar 10, 2010

I know this is possible to be done using javascript, and I presume I could get the values to flash calling js, but I'm looking for any AS3 library/code that does the same.

js examples: [URL]

View 1 Replies

Flex :: Datagrid Data Splitting - Show All Column Values And If Uncheck Columns Has To Show

Jan 23, 2012

In my flex datagird i have a checkbox and a datgrid with seven columns. im populating values in first five column(remaining two column no values) of datgrid by an Arraycollection. now,By clicking the checkbox i want to show all seven column values and if i uncheck five columns has to show... how its possible?? heres my code

[Code]...

View 1 Replies

Flex :: Event Like ItemEditEnding Or Any Other Way To Stop Event Before ItemEditEnd Event In Datagrids?

Apr 12, 2011

I have editable grids which are 2-way binded to my model. What I want is to validate my data when user edits any cell before it get updated in model. I have applied my validation at ItemEditEnd handler, but, I want to apply validation in between itemEditBegin and itemEditEnd events.

View 1 Replies

ActionScript 3.0 :: Nested DisplayObjects?

Oct 15, 2009

I am "old style" guy who still use Flash authoring environment as I believe working with graphics this way is easier than scripting all the things in document class..So, I have created in Flash authoring a movieClip with a graphics nested in it. Actually, this graphic is composed of two other nested graphics:

Graphics_
Graphics_C
/

[code]....

View 8 Replies

Flex :: Event Flows For Built-in Event And Custom Event

Aug 22, 2011

I hava a custom component and it contains a child icon. If I add a mouse-click event listener to both component(click-listener1) and icon(click-listener2), the event dispatched sequence is click-listener2, then click-listener1. I can understand it. But if I add a custom event to component (listener1), and mouse-click event to icon(listener2), when icon is clicked, the component will dispatch the custom event. In my test, the event dispatched sequence is listener1, then listener2. It doesn't match with event-bubbles rule.

In my opinion The custom event is dispatched in listener2, which triggers listener1. Why event flow sequence is not listener2, listener1?

In component.

icon.addEventListener(MouseEvent.CLICK, iconClickHandler);
private function iconClickHandler(event:MouseEvent):void
{

[Code].....

View 1 Replies

Flash - DisplayObjects As Animation Frames?

Apr 5, 2010

How can I use displayObjects as animation frames?I have six symbols in my library I want to animate with a timer. The advantage would be the ability to change the speed of the animations, and the elimination of the messy timeline.

The only drawback is the initial setup of the objects in the library. I've tried switch/case design patterns, visible=true, and z-depth, but I can't get it to work properly. Any answers?

//setup code
var timer:Timer = new Timer(100, 20);
timer.addEventListener(TimerEvent.TIMER, countdown);
function countdown(event:TimerEvent) {

[code].....

View 1 Replies

Flash :: Copy DisplayObjects With Content?

Oct 12, 2010

How to copying display objects (sprites, movieclips etc) while keeping thier content (graphics, added display objects etc)in AS3? The most commonly suggested solution by Kirupa (

[Code]...

View 5 Replies

Xml :: Representing Nested Folders As DisplayObjects

Apr 21, 2011

I'm working on a world builder that will load a toolkit which is represented by an xml document. The document will look similar to the following:[code]Now, I want to be able to represent this structure in flash. Vertical layout is easy enough, simply placing the elements from top to bottom. It gets mind-boggling when I need to do the following:Be able to click any folder and have all its children hidden/shown.Position the elements horizontally based on hierarchical position (indent children of folders, children of the child folders, etc)Position the folders/tools vertically when folders above and in the same "directory" are hidden.It either sounds a lot easier than it is, or I'm missing a vital and obvious step.Just to save confusion - when I make reference to "folders" and "tools", these are a MovieClip which is a simple block with text over it, like:[code]

View 1 Replies

ActionScript 3.0 :: Working With Nested DisplayObjects

Apr 2, 2008

I'm creating my first AS3 project and I've already hit my first snag, nested display objects (aka buttons and movieClips). Let's say you create a movieClip and place buttonA on frame 1 and buttonB on frame 10. You create a class for that movieClip that tells it to jump to frame X after evoking a custom method. With the same method you want to assign the buttons on that frame their functions, but you can't because Flash thinks that DisplayObject does not exist. How do you make sure all DisplayObjects for a frame have been loaded, so that you can reference them?

I have figured a way around it by using the ADDED event listener. Apparently this event is triggered every time any DisplayObject is added, whether it is nested or not. What's interesting is the number of children (numChildren) for the parent movieClip stays constant. So, this code takes advantage of that fact.

[Code]...

View 2 Replies

ActionScript 3.0 :: Create Swf File Without Any DisplayObjects?

May 21, 2011

I want to create swf file without any DisplayObjects. All it has to do detect Events and save a Log. My main Application will load it as external swf file.

Is any way I can compile swf file do not extending Sprite or MovieClip?

View 14 Replies

ActionScript 3.0 :: How Would These DisplayObjects Be Garbage Collected

Feb 3, 2012

there is a Class A, it has a timer which updates its x position periodically. So all the instance of Class A will update their own x position. There is another Class B which extends Class A and overrides the function which updates position to change y position and call the trace function.

Now what I do now is create two instance alpha1, alpha2 of Class A and other two instance beta1, beta2 of Class B.

- alpha1 is only instantiated, but not added to the stage.

- alpha2 is instantiated, and there after added to the stage.

- beta1 is only instantiated, but not added to the stage.

- beta2 is instantiated, and there after added to the stage.

- let say after few seconds, I remove alpha2 and beta2 from stage.

Now suppose the GC fires collection, who all would be collected ?

View 1 Replies

ActionScript 3.0 :: Flash Not Setting Width Of DisplayObjects?

Apr 20, 2009

I've got another interesting Flash issue, and I was wondering if there was some weird case I had to account for.  Here's the code: var c:DisplayObject; var t:Rectangle; c.width = t.width; trace(c.width, t.width); This results in output of: 0 13 I'm expecting '13 13' as the output..what would cause this to happen?  It's sporadic, sometimes it'll happen, sometimes it doesn't.  Is there some weird race condition I should double check for?

View 5 Replies

Actionscript 3 :: Calculate The Bounding Box Around A Group Of DisplayObjects?

Jan 27, 2010

I have an array of Sprites on stage and want to now the rectangle that bounds them. I could do a loop and check each element's getBounds() but that could be computationally expensive.

View 1 Replies

Flash :: AS3 - Give DisplayObjects Custom Properties?

Oct 10, 2010

I am very new to AS3, and I'm confused about how things that would have been simple in AS2 are so complex and tricky now. For example, I want to create a bunch TextField objects that, for some reason, rise up every frame (as in : object.y-=1; ).However, I also need each TextField to reference the TextField that was created just before it.

I tried creating a variable that would hold such a reference : ThisTextField.Ref=LastTextField; but - this returns an "Access of possibly undefined property..." error. It seems I can only have custom properties on mere Objects ! This is annoying because an Object doesn't seem to accept event listeners (remember, I need them to do something every frame). Is there a way to simply set custom properties on my TextFields, without having to use custom packages ? Or is there a way to use event listeners on Objects ? I've read something about strict mode which could allow setting properties on other objects - what are the risks of turning it off ?

View 3 Replies

ActionScript 3.0 :: Function That Creates Custom Displayobjects?

Mar 18, 2011

ActionScript Code:
private function drawMap(tile1:DisplayObject, tile2:DisplayObject):void
{
var _tile1 = tile1;

[Code].....

The idea behind this is to store custom sprites in an array and then feed the array to the drawMap function, which would use the sprites from the array to draw a map.

View 1 Replies

ActionScript 3.0 :: Why Bitmaps Are Not Considered Children Of DisplayObjects

Jul 20, 2011

why Bitmaps are not considered children of displayObjects (at least from my observations, I think this is true). They themselves are displayObjects so therefore should be part of the display list. In fact, when multiple Bitmaps are in one MovieClip, it recognizes them as one child, a Shape instance. Could anyone explain this to me? I'm attaching an example with a few display objects in a movieclip.

View 8 Replies

ActionScript 3.0 :: Using Events To Notify Unrelated Displayobjects

Oct 1, 2009

I wanted to use dispatchEvent inside the MOUSE_OVER event of a menu item, setting the event type to a unique label which another displayobject somewhere in the display list (NEITHER a parent nor a child of the event dispatcher) would listen for, so that it could brighten. See the following lines of code:

in menu item class MOUSE_OVER handler: dispatchEvent( new MenuEvent( xml.@label.toString().toUpperCase()+"over") );

in "site button" class constructor - the thing I want to respond to your hovering over the menu by brightening (which over() does) :
addEventListener( xml.@label.toString().toUpperCase()+"over", function( e:Event ) { SiteButton( e.currentTarget ).over(); } );

It doesn't work. I screwed around with capture and bubble parameters.

how to do what I want in a simple way? I spent 2 hours already trying to figure this out.

View 1 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

ActionScript 3.0 :: Show Hide Buttons On Stage On Mouse Over Event?

Jan 11, 2010

Smarter than I Fellows:I've uploaded a source .fla for my project: [URL]I'm trying to get out of timeline based animation and start using AS.... I've been watching adobe tv and reading, reading. I can look at AS and understand it, but am far from knowing where to start when building something.Here for example I simply want my previous and next buttons to display hidden at the beginning of the movie and then show when the user mouses over the stage.

Of course they should also on click let us navigate from slide to slide and the slides will transition in and out on X axis with nice easing and a blur (i'm trying to mimic the action found at FontExplorerX [URL]. Right now, I'm just tying to get my buttons to not appear until mouseover (maybe they should appear on load and disappear after a delay and then reappear on mouseover - the mouseover trigger would be the whole stage for both buttons, not just the specific area).

View 1 Replies

Professional :: Splitting Image - Increasing DisplayObjects X Positions

Sep 24, 2010

I'm new to ActionScripts and was tasked to complete a project. I'm trying to split a big image so I can send them to a http server in chunks. I'm using a recursive function below and increasing the DisplayObjects X position on every iteration. The problem is I get the same image in every iteration and checking the encodeByteArray string value is always the same.

Code:
var currentTileIndex:int = 0;
function renderNextTile(e:Event):void{
if(currentTileIndex < tilesToLoad){
loader = new URLLoader();
[Code] .....

View 2 Replies

Performance :: Are Off-stage DisplayObjects In Flash Still Slowing Down The Game

Feb 21, 2012

How does Flash deal with elements that are off-stage?Obviously Flash doesn't actually render them (because they don't appear anywhere on-screen), but is the process of rendering them still existent, slowing down my game as much as it would if the elements were on-screen?

Or does Flash intelligently ignore elements who don't fall into a renderable area?Should I manually manage removing objects off the DisplayList and adding them back on as the exit and enter the stage, or is this going to be irrelevant?

View 2 Replies

ActionScript 3.0 :: Masked DisplayObjects And Getting Height/width/dimensions?

Oct 28, 2009

anyway, so i'm having an issue when getting the dimensions of an image that is masked. I want to get only the dimensions of the visible image, but AS3 seems to only return the height/width of the whole image, even the areas that are not visible (because of the mask).

I could create a custom class that extends the DisplayObject and overwrites the height and width getter to return the dimensions of the mask, but my problem is that I'm placing these masked images into a container DisplayObject, and scaling that container to fit the browser window.

View 6 Replies

Actionscript 3 :: Parent Sprite And It's Children DisplayObjects Do Not Fade In/out Simultaneously

Dec 10, 2010

I'm trying to simulate some fade in/out effects in Action Script 3 programmatically, using Timer class and controlling alpha property of the specified DisplayObject in time. In general it works and looks great. As I was expecting. But after I add some more child DisplayObjects to the parent Sprite it starts to behave weirdly. Children seem to not fade at the same rate as parent object and it visually noticeable, and ugly. There seems to be a short lag after parent already started to fade out and before children actually follow. Are there any additional measures I should take to avoid that? I do alpha manipulation only on parent object. I thought that'd be logical...

View 2 Replies

ActionScript 3.0 :: Offscreen DisplayObjects - How Does Flash Player Handle Objects When They Are No Longer On The Visible Stage

Dec 28, 2010

How does flash player handle objects when they are no longer on the visible stage? Is the graphical data still in memory? Does hittestobject/point consider them? Are enterframe and interval events still running?

In AS2 I would hold metaobjects (minimal x,y,width,height data) that would delete/create movieclips as the screen scrolled. Is this still a correct approach in AS3? If not, is there anything I can do to offstage display objects that improves efficiency, assuming around 400 are created initially?

View 4 Replies







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