actionscript-3,flex,memory-leaks,air,desktop-application , Itemrender of DataGroup won't release memory - flex(Adobe air)

Itemrender of DataGroup won't release memory - flex(Adobe air)


Tag: actionscript-3,flex,memory-leaks,air,desktop-application

i have a datagroup compoenent in Adobe Air application and i have used custom itemrenderer in it, i attached source code of itemRenderer as well as i attached profiling of it,

Question: When i come back from other module to the module which have this datagroup at that time it again create Objects for itemrender and previous object of itemrender wont released.

if you have idea, please suggest me

<?xml version="1.0" encoding="utf-8"?>
<s:ItemRenderer xmlns:fx=""
            import coX.XXXXXXXXXXXXXXX.event.ThumbEvent;


            protected function image_completeHandler(event:Event):void
                ConsoleUtils.logIt(" ThumbImage.mxml :image_completeHandler - ");
                image.removeEventListener(Event.COMPLETE, image_completeHandler);

            protected function clickHandler(event:MouseEvent):void
                owner.dispatchEvent(new ThumbEvent("itemclick", data, itemIndex));

            protected function rollOverHandler(event:MouseEvent):void
                owner.dispatchEvent(new ThumbEvent("itemrollover", data, itemIndex));

            protected function rollOutHandler(event:MouseEvent):void
                owner.dispatchEvent(new ThumbEvent("itemrollout", data, itemIndex));

            protected function itemrenderer1_removedFromStageHandler(event:Event):void
                this.removeEventListener(Event.REMOVED_FROM_STAGE, itemrenderer1_removedFromStageHandler);
                this.removeEventListener(MouseEvent.ROLL_OUT, rollOutHandler);
                this.removeEventListener(MouseEvent.ROLL_OVER, rollOverHandler);
                this.removeEventListener(MouseEvent.CLICK, clickHandler);


            protected function itemrenderer1_creationCompleteHandler(event:FlexEvent):void
                this.removeEventListener(FlexEvent.CREATION_COMPLETE, itemrenderer1_creationCompleteHandler);
                //image.addEventListener(Event.COMPLETE, image_completeHandler);

        <s:Fade id="fadeIn"

    <s:BitmapImage id="image"


Snapshot of Profilingprofiling_snapshot_which_shows_memory_leak

as you can see, in profile, i have 21 orphan objects which won't recyle and profiling shows me that at saved at line no 12 while line no 12 is creation_complete event and i have removed it.

Thanks in Advance


i have used DataGroup as parent component and i have define above itemRenderer in itemRenderer property of the DataGroup, and in dispose function i have define DataGroup.itemRenderer is null in DataGroup. so it will eligible for GC. and i see that now no instance of itemRenderer is in memory.


Remove click after going to another scene in AS3?

After switching to my 2nd scene, the keyboard event does not work until I left-click the screen. How to avoid that left click so that I can trigger my keyboard event directly right after moving to my 2nd scene? More details you may need: 1st Scene btnStart.addEventListener(MouseEvent.CLICK, initGame); function initGame(e:MouseEvent)...

Including library in AIR Native Extension causes the error, “The extension context does not have a method with the name…” for all methods

I am working on an AIR Native Extension (ANE) for Windows desktop. The point of this extension is to be able to call out to a third-party C library, which consists of two .h files defining the method signatures/typedefs, and a .lib file. Before including the third party library in...

AS3 - removeChild thinks it's working, but isn't removing anything (no error)

This is similar to a question I asked a couple of weeks ago, but different code and previous solution is not working. In a nutshell, I'm creating an array of tiles, the size of which can be selected via a dropdown menu. I want the previous grid to be removed...

Adobe Flash CS6 AS3: KeyUp Handler triggers immediately after KeyDown Handler

So in my code I was attempting to make it where you had two players, each player had their own key down and key up handlers, clearly labelled in my attached code, and in their I handle the movement, player one has WSAD and player two uses the Left, Right,...

A movie clip above a simple button makes it unresponsive

I have designed a menu in Flash CC which consists of several cloned buttons and an MC containing the text that is supposed to stay above the buttons. Each time a user switches the menu's page, AS commands the clip to switch to appropriate frames, therefore changing the text above...

AS3 Dynamic variable naming

Is dynamic variable naming like this possible in ActionScript 3? for (var xz=0;xz<10;xz++){ var this['name' + xz]:Number = xz; } ...

How can i get a function to use any movie clip?

I'm a little lost in understanding this kind of function, i get the feeling this has been asked a thousand times but cannot find an explanation of what the code is doing. Basically i just want a movie clip with instance name box to do something, then reuse the function...

action script 3 whole number as a division output

hello, I want to get whole number after division. x = 3/2; //results x = 1 and not 1.5 how to do this in as3??...

type conversion if flex

I am using Flerry as Java-Flex bridge for my Flex Desktop Application. How to convert List in Java to ArrayCollection in Flex Flex Code:- [Bindable]public var screenList:ArrayCollection; <flerry:NativeObject id="windowControllerObj" source="ls.window.EnumAllWindowNames" singleton="true" fault="windowControllerObj_faultHandler(event)"> <flerry:NativeMethod id="getWindowNames" name="getAllWindowNames" result="windowControllerObj_resultHandler(event)" fault="getWindowNames_faultHandler(event)"/>...

How make with AS3 downloading MP3 files in the background mode and plays it?

I need help with AS3 make downloading MP3 files in the background mode. Man goes to my site and it will automatically load MP3 file on his computer and plays it. I read these examples here but do not know how to do it? Prompt what code and how...

How to remove all Objects in For Loop?

Hey Everyone So I know this has to be really Simple I am over complicating it and can't figure out how to do it. So I have these stars moving in the background in my startScreen and I want to remove them when the Game starts. Here is How I...

converting XML data into an array of objects AS3

I'm using Flash AS4 and Ive created and array that holds xml data which works fine with the following loop for(var i:int = 0; i < uNavXML.length(); i++){ navArray.push(uNavXML..navRef.text()[i]); The XML data is actually the names of movie clips that I have on stage: xmlLIST :<uNav> <unavNavID>1</unavNavID> <navRef>navBtns.nav01</navRef> </uNav> <uNav>...

why and when override public function set data

i had make some research over the internet about the itemRender i just found some articles that describe the itemRender like Adobe Item Render , The Best Practice with item render in flex development all these articles explain how ItemRender works ? but they did not specified why we are...

Is there a class in AS3 that tells you the type of the URL protocol?

Is there a class in AS3 or Flex that tells you the type of protocol a URI or URL is part of? I was sure there was a class that broke a URL into various parts and grouped it into usable data. For example, if the URL is, "mailTo" it...

AS3 - Score counter

I am making a simple math game with four frames. In the first frame you can choose the math operation you want to practice. In the second frame you are presented with a randomly generated math question. If you enter the correct answer, the application outputs "correct answer", and skips...

Flex box in flex box, and positioning not works. (Flexbox in flexbox)

UPDATE For those, whom not like the inline CSS, and want classes, here are another jsFiddle with classes and with stylesheet. UPDATE END I want to make a product page. It will have three columns. The first is the picture, second is some specification, third is the "into basket". All...

how to fix error 1009 in as3

hi i have been searhing the net for hours and have not found a solution to my problem and i have no idea how to fix it as i am only new to flash so if you know anything that might help me just comment below please all help is...

ActionScript: Specification of the is operator

I am having trouble googling for the expected behavior of the is operator in AS3. What I need to know is what should happen if the left side is null. I know it is possible to test, and get empirical results, but I need to know what the specification says,...

Search for exact word or phrase in Flash Builder's “Search” tool?

How do I search for an exact match to a phrase or word in Flash Builder's search tool? For example, in my project I have a class with a function named "removeEvent". If I search on it, I get all instances where "removeEventListener" is used and of course that is...

Why isn't this php math code working

Hey guy's so am trying to convert this as3 code to php but its not working correctly i need it like the as3 one generating thanks! PHP: print(floor(rand() * 1000) + 3000); Result:28240000 AS3: var intCID = Math.floor(Math.random() * 1000) + 3000; var strSessionId = String(intCID); trace(strSessionId); Result:3330...

How can hitTestObject work for many objects?

I have a game where player moves forward over (semi)random tiles. I want a hittest for when the player hits a certain tile. However when the char hits one of the spawned in floor2's nothing happens. I think this is because there are multiple 'floor2' movieclips on the stage ?...

Error #1502: A script has executed for longer than the default time period of 15 seconds

this is my first time using AS3 so I apologise if the cause of this problem is painfully obvious. I'm making chess and I've got a class for each piece on the board. When it's player 1's turn, all the black pieces should wait to be clicked, but when I...

How to convert preg_replace from PHP to AS3?

I'm doing a fan Transformice map editor, but I've a question, "How can I do a preg_replace in Flash AS3?"... This is something like <? $mapXml = "<C><P /><Z><S><S L="304" H="65" X="175" Y="355" T="6" P="0,0,0.3,0.2,0,0,0,0" /></S><D /><O /></Z></C>"; $mapXmlDisplay = preg_replace('<S L="(.*)" H="(.*), etc..."', 'someThing', $mapXml); ?> It's possible? Thanks...

AS3 can't find the load method on a Loader

I'm trying to load an image from the internet with AS3 following this tutorial. When I try to compile the application I get the following error: Call a possibly undefined method load through a reference with static type Loader. my_loader.load(where, loaderContext); ^ Here is the code I'm using: package {...

AS3 : How to compare 2 array containing objects using 1 for loop only?

I have 2 array having objects of different length var arr : Array = [{name : "aa", id : "0"}, {name : "bb", id : "1"}, {name : "cc", id : "2"}]; var arrTemp : Array = [{name : "ee", id : "0"}, {name : "hh", id : "1"}, {name...

how to zoom stage to rectangle area in as3 (Action Scripts 3)?

how to zoom stage to rectangle area in as3 (Action Scripts 3)? i have a text, when mouse over the ever word, color changed. now, when click the word i need to zoom to this word and hide the other word?...

Activerecord Rails 4 perform something like a join that still returns rows that don't have the association

If after reading my question you have a suggestion for a better title, please add a comment. I was having trouble succinctly saying what I wanted. I have a situation like this. class Artist < ActiveRecord::Base has_many :album_artists has_many :albums, :through => :album_artists end class Album < ActiveRecord::Base has_many :album_artists...

Find and replace in an AS3 String

I want to find the "(*" string in another string and then replace it with the < and / one but the method replace() can not do it. Sorry, but I can not write the string in the description together :D Here is my code: //Call the method like.. trace(searchandreplace("(*Foo)"));...

AS3: Fast hovering doesn't execute rollOut

I'm having a serious problem that is getting me nervous: I've made a button _btn that includes ROLLOVER and ROLLOUT animations with coding (an nested movieclip instance called barra that increases to half alpha when you hover over and decreases when you hover out). [Here it should go a descriptive...

Fisher-Yates Shuffle Algorithm error

so I'm currently making a quiz game with Actionscript 3.0, and I wanna shuffle the questions with this Fisher-Yates Shuffle Algorithm: This is my code: var questions:Array = [1,2,3,4,5,6,7,8,9,10]; function ShuffleArray(input:Array) { for (var i:int=input.length-1; i>=0; i--) { var randomIndex:int = Math.floor(Math.random() * (i+1)); var itemAtIndex:int = input[randomIndex]; input[randomIndex] =...

ActionScript: How to listen for an event from a different XML

I have a popup screen in which the player enters their name and clicks OK. When OK is clicked I want the player's name to be passed to the main XML. How can I do this? Here is the function in the main XML that handles the popup: private function...

AS3 LocalConnection: function is not firing

I'm building an AIR app that sends text string to a swf-file. When I export the sender and reciever apps to swf and run them in Flash players, everything works well. But when publishing the sender app to AIR things don't work anymore. I think the connection works, because there...

Difference between AMFChannel and pollingAMFChannel

I found an Adobe document that defines the amfChannel Adobe amfChannel. Is there a big difference between amfChannel and pollingAMFChannel? FlashBuilder 4.7 does not provide any documentation.

AS3 - How do you call previous currentTarget from within a different event?

I have a dropdown menu that lets you select an item to be placed on the stage. The item is drag and droppable so I use event.currentTarget.startDrag(); to start the drag. Ok, everything works fine so far. However, I also need to be able to rotate the item while it...

Two ane file conflict in one flex mobile application

I have two ane file for video recorder. One is for android and another is for ios device. Both have different package name and methods. Now, i import both Native Extension in single project. And detect ios and android device following way: if(Capabilities.version.indexOf('IOS') > -1) //for ios device And if(Capabilities.version.indexOf('AND')...

Can't parse XML AS3 in flash with namespaces [SOLVED]

I don't understand why I can't parse these datas : <places yahoo:start="0" yahoo:count="1" yahoo:total="1" xmlns="" xmlns:yahoo=""> <place yahoo:uri="" aaa:lang="en-US" xmlns:aaa=""> <woeid>23424819</woeid> <placeTypeName code="12">Pays</placeTypeName> <name>France</name> <country type="Pays" code="FR"...

Building a digital signage platform in HTML5

I need some feedback! So if any help, Thank you! I'm a developer for a digital signage company. We built a platform in Flash (ActionScript 3) and it has been running really smooth for a few years now. We've been talking about trying to move to HTML5, JQUERY and PHP...

mobile friendly CSS multi column layout that doesn't suck like flex

I implemented a flex multi column layout, got it to look great on my desktop, then looked at it on a mobile device and it was complete trash (all scruntched together, ignoring width parameters completely). Played with it for hours and everywhere I went on the internet said flex sucked...

SCORM API wrapper and Flash in full screen

I lately posted this and unfortunately I couldn't figure it out why. Furthermore I haven't any solution for that. Today I realised I can switch between NORMAL and FULL_SCREEN without SCORM parts of the content (connect/disconnect, get/set, etc.). But when I check both Flash wrapper and Mike Rustici's edited API...

AS3 Check if no object in an array is being hitTested

I have an array of platforms that I'm hitTesting against a player. I also have a boolean variable called onGround that is attached to the player. I need to be able to toggle onGround based on whether or not the player is hitting a platform in the array. It's been...

Actionscript 3 Search for string in array, propblem

I have a problem with searching for strings in an array. I want to search for one word and if it exists, I want to trace the position of the string in the array. I believe it should be something like this: if (myArray contains "11111111") { trace("*position*") } else...

Edit Manager activePoint “Y” Position ActionScript3

I'm working with TextFlow and EditManager in AS3 (flashx.textLayout) I want to know how get ActivePosition pointer "Y" position, I know I can get activePosition from EditManager but it's returns character position. I want to count if activePosition out of screen, then scroll down (text is larger and its out...

Flash CS6 / AS3: Drag and Resize a rectangle movieclip

Not sure if this is possible but going to ask: is there a way of being able to resize a symbol (in this case, a movie clip) in an swf file by clicking and dragging it with your cursor? One of the things I need to do is have a...

How to know fast if another computer is accesible in AS3 (Adobe Air)

I'm using FileStream to read files in two computers that are connected in a Local Area Network (LAN). I have no problem to read the files when the others computers are connected. I'm checking if the directory exists before writing the file I'm checking if the directory AND the file...

call Win32 API in flex to set Window Display Affinity

I have created a Flex Desktop Application with Adobe Air. I need to protect the application from being captured. By changing the window display affinity of the application, the application can be protected from being captured. How to use win API in flex? Is there any other way to protect...

Dynamic Text doesn't show up through code

if I make a dynamic text on the stage, name it something like "output" And I write in the enterframe. output.text = "Something"; It doesn't even show up in the stage, and the text box is blank....