[flexcoders] FlexNativeMenu crash in the LayoutManager

2010-07-22 Thread Christopher McArthur
This is in Flex 3.2:

 

We have a rare crash in one of our components. We have no repro case,
but we were able to catch it in the debugger once and get a callstack.
Ive included the callstack at the bottom of this message. The error is:

 

-: TypeError: Error #1034: Type Coercion failed: cannot convert
mx.controls::flexnativem...@234d7df1 to flash.display.DisplayObject

 

called from:
mx.managers.layoutClasses::PriorityQueue/removeLargestChild

 

 

Trying to figure out how this could happen... No component on this page
actually even uses FlexNativeMenu... So that's odd. But we do use it in
other parts of our application. We use it declared in mxml and we use it
declared in .as. But, we don't do anything strange with it, and
certainly not on this page.

 

Tried to do research on exactly  what removeLargestChild does, and why
it would be trying to remove a FlexNativeMenu, but no dice.

 

Anyone have any clues as to what I should dig in for here, or what the
LayoutManager may be trying to do here?

 

-ctm 

 

 

callstack:

 

Main Thread (Suspended: TypeError: Error #1034: Type Coercion failed:
cannot convert mx.controls::flexnativem...@234d7df1 to
flash.display.DisplayObject.)

mx.managers.layoutClasses::PriorityQueue/removeLargestChild

mx.managers::LayoutManager/validateClient

mx.core::UIComponent/validateNow

mx.core::Container/createOrDestroyScrollbars

mx.core::Container/createScrollbarsIfNeeded

mx.core::Container/createContentPaneAndScrollbarsIfNeeded

mx.core::Container/validateDisplayList

mx.managers::LayoutManager/validateDisplayList

mx.managers::LayoutManager/doPhasedInstantiation

Function/http://adobe.com/AS3/2006/builtin::apply [no source]

mx.core::UIComponent/callLaterDispatcher2

mx.core::UIComponent/callLaterDispatcher

 



RE: [flexcoders] FlexNativeMenu crash in the LayoutManager

2010-07-22 Thread Christopher McArthur
Actually a context menu isnt being used on this screen.. but it is on
previous screens. I will try littering those with validateNows just in
case.. maybe one of them is still alive for some reason or something...

 

We are having some issues with the flex4 upgrade, so its delayed, doh. 

 

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Alex Harui
Sent: Thursday, July 22, 2010 4:49 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] FlexNativeMenu crash in the LayoutManager

 

  

That's a bug in Flex 3.x.  It is fixed in Flex 4.

Is a context menu being used in this scenario?  You might try calling
validateNow() before doing the rest of the work of the context menu
option.


On 7/22/10 11:44 AM, Christopher McArthur cmcart...@riotgames.com
wrote:


 
 
   

This is in Flex 3.2:
 
We have a rare crash in one of our components. We have no repro
case, but we were able to catch it in the debugger once and get a
callstack. Ive included the callstack at the bottom of this message. The
error is:
 
-: TypeError: Error #1034: Type Coercion failed: cannot convert
mx.controls::flexnativem...@234d7df1 to flash.display.DisplayObject
 
called from:
mx.managers.layoutClasses::PriorityQueue/removeLargestChild
 
 
Trying to figure out how this could happen... No component on
this page actually even uses FlexNativeMenu... So that's odd. But we do
use it in other parts of our application. We use it declared in mxml and
we use it declared in .as. But, we don't do anything strange with it,
and certainly not on this page.
 
Tried to do research on exactly  what removeLargestChild does,
and why it would be trying to remove a FlexNativeMenu, but no dice.
 
Anyone have any clues as to what I should dig in for here, or
what the LayoutManager may be trying to do here?
 
-ctm 
 
 
callstack:
 
Main Thread (Suspended: TypeError: Error #1034: Type Coercion
failed: cannot convert mx.controls::flexnativem...@234d7df1 to
flash.display.DisplayObject.)

mx.managers.layoutClasses::PriorityQueue/removeLargestChild
   mx.managers::LayoutManager/validateClient
   mx.core::UIComponent/validateNow
   mx.core::Container/createOrDestroyScrollbars
   mx.core::Container/createScrollbarsIfNeeded

mx.core::Container/createContentPaneAndScrollbarsIfNeeded
   mx.core::Container/validateDisplayList
   mx.managers::LayoutManager/validateDisplayList
   mx.managers::LayoutManager/doPhasedInstantiation
   Function/http://adobe.com/AS3/2006/builtin::apply [no
source]
   mx.core::UIComponent/callLaterDispatcher2
   mx.core::UIComponent/callLaterDispatcher
 
 
   




-- 
Alex Harui
Flex SDK Team
Adobe System, Inc.
http://blogs.adobe.com/aharui





RE: [flexcoders] Set Width of An Item Renderer Component Based on Visible Property of the Control

2010-05-20 Thread Christopher McArthur
the includeInLayout property may also be helpful to you in this case, try:

includeInLayout={outerDocument.fncVisible()}

 

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf 
Of Angelo Anolin
Sent: Thursday, May 20, 2010 2:46 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Set Width of An Item Renderer Component Based on Visible 
Property of the Control

 

  

Hi FlexCoders,

 

I have declared an in-line item renderer in my datagrid:

 

mx:DataGridColumn headerText=Test textAlign=center sortable=false

  mx:itemRenderer

mx:Component

  mx:HBox horizontalAlign=center 

mx:LinkButton id=lnk1 label=Link 1 
visible={outerDocument.fncVisible()} width={???}/

mx:LinkButton id=lnk1 label=Link 1 /

mx:LinkButton id=lnk1 label=Link 1 /

  /mx:HBox

/mx:Component

  /mx:itemRenderer

/mx:DataGridColumn

 

 

as you may see, I am determining the visibility of the link button via a 
function.  What I want to achieve is that if the linkbutton contrl is 
invisible, the width should be 0, but if it is visible, then width should be 
100.

 

How do I pass in a function for the width of the control whether it's 
visibility is set to true or false?

 

Thanks.

 



image001.jpgimage002.jpg

RE: [flexcoders] mvc pattern for flex

2010-05-05 Thread Christopher McArthur
using Swiz here which works well for dependency injection, I would
recommend it.

 

However, Ive been hearing a ton of great things about RobotLegs
recently.

 

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Fernando Wermus
Sent: Wednesday, May 05, 2010 7:46 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] mvc pattern for flex

 

  

Hi all,

I was looking at Aconcagua. but there is a line of new code since a
year and a half.

Puremvc seems to be a kind of big compared to Cainrgorm.

 

Which options have you choosen as the best for MVC in Flex?

 

I know Caingorm and I dont like.

 

thanks in advance


-- 
Fernando Wermus.

www.linkedin.com/in/fernandowermus

 



RE: [flexcoders] Flash Builder 4 java heap space error.

2010-04-28 Thread Christopher McArthur
Thanks for the detials.

 

Unfortuantely, Ive increased the numbers a great deal, tried a variety
of different values, and read through the nice page you linked, and I am
*still* getting the errors.  And not just me, my entire development team
on a large variety of hardware.

 

Any suggestions on what our next steps should be?

 

-ctm

 

 

 

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Oleg Sivokon
Sent: Tuesday, April 27, 2010 1:01 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Flash Builder 4 java heap space error.

 

  

Increase JVM memory

 

-Xms Am -Xmx Bm

 

(A is the initial memory size B is the maximum size in megabytes)

you may do this globally in jvm configuration file, or per application
run. I even think that MXMLC will accept -jvmargs parameter to pass
arguments to jvm before it starts (MXMLC exe is a launcher, that
launches the mxmlc.jar).

More here:

http://www.caucho.com/resin-3.0/performance/jvm-tuning.xtp



Reply to sender
mailto:olegsivo...@gmail.com?subject=re:%20[flexcoders]%20Flash%20Build
er%204%20  | Reply to group
mailto:flexcod...@yahoogroups.com?subject=re:%20[flexcoders]%20Flash%20
Builder%204%20  | Reply via web post
http://groups.yahoo.com/group/flexcoders/post;_ylc=X3oDMTJzNjRuaWE3BF9T
Azk3MzU5NzE0BGdycElkAzEyMjg2MTY3BGdycHNwSWQDMTcwNTAwNzIwNwRtc2dJZAMxNTUx
NDcEc2VjA2Z0cgRzbGsDcnBseQRzdGltZQMxMjcyMzk4NDk5?act=replymessageNum=15
5147  | Start a New Topic
http://groups.yahoo.com/group/flexcoders/post;_ylc=X3oDMTJmNWlpaWxxBF9T
Azk3MzU5NzE0BGdycElkAzEyMjg2MTY3BGdycHNwSWQDMTcwNTAwNzIwNwRzZWMDZnRyBHNs
awNudHBjBHN0aW1lAzEyNzIzOTg0OTk-  

Messages in this topic
http://groups.yahoo.com/group/flexcoders/message/155144;_ylc=X3oDMTM5NW
1hZWM0BF9TAzk3MzU5NzE0BGdycElkAzEyMjg2MTY3BGdycHNwSWQDMTcwNTAwNzIwNwRtc2
dJZAMxNTUxNDcEc2VjA2Z0cgRzbGsDdnRwYwRzdGltZQMxMjcyMzk4NDk5BHRwY0lkAzE1NT
E0NA--  (2) 

 



[flexcoders] Flash Builder 4 java heap space error.

2010-04-27 Thread Christopher McArthur
Flash Builder 4 is crashing constantly for me with a java heap space
error when compiling. It is driving me nuts.

 

Im running on Windows Vista 64bit and 4GB of RAM. When this error occurs
FlashBuilder is using about 780MB of RAM, and I have about 1.5GB of ram
still free

 

Research online suggests messing around with the vmargs in
flashbuilder.ini. Ive tried changing the settings to ones people
reccomended online to no effect.  Im really not sure what these settings
actually mean, so not sure what effect changing them has or what the
right numbers are. I tried raising them all  and still get a lot of heap
errors.

 

 

Can anyone give me any advice?

 

-ctm

 

 



RE: [flexcoders] What is the MXML syntax for this?

2010-04-15 Thread Christopher McArthur
Thanks for the response Alex.

 

And this works great for my test example! 

 

However, I am curious, is this as deep as you can go, one level? Or is
it possible to nest it deeper? 

 

Just trying to get an idea of whats allowed and how its actually
working.

 

Nesting one level deeper, in a simple test application, I get the error
:

could not resolve local:imageVar to a component implementation.

so, for an example, if you had a ParentContainer, that had a variable
named childComponent, that has a variable named imageVar.

 

 

local:ParentContainter

local:childComponent
  local:imageVar
mx:Image source=myTestImage.jpg /

/local:imageVar
/local: childComponent 
/local: ParentContainter 

 

This gives the could not resolve local:imageVar to a component
implementation. error.

 

 

 

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Alex Harui
Sent: Wednesday, April 14, 2010 10:06 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] What is the MXML syntax for this?

 

  

Are you looking for:

local:myContainerComponent id=containerComponent
local:imageVar
mx:Image source=myTestImage.jpg /
/local:imageVar
/local:myContainerComponent


On 4/14/10 12:53 PM, Christopher McArthur cmcart...@riotgames.com
wrote:


 
 
   

I have a component, that has a property of type Image. I need to
assign a new Image component to it. this is trivial to do in action
script. But, how do I do it in MXML?
 
Example:
mxml:
local:myContainerComponent id=containerComponent/
 
actionscript: 
var myImage:Image = new Image(myTestImage.jpg);
containerComponent.imageVar = myImage;
 
 
Is there anyway to do that creation of the image, and assignment
purely from MXML? The image cant be a child of anything else, so I cant
just declare it randomly somewhere in the same container.
 
 
For context, im using the Flash Component Kit, and the
myContainerComponent is a container exported from flash a
mx.flash.ContainerMovieClip. And it requires you to assign a component
to its content property. Ideally, id like to create and assign this
content component using mxml only.
 
 
 
 
 
   




-- 
Alex Harui
Flex SDK Team
Adobe System, Inc.



 



[flexcoders] What is the MXML syntax for this?

2010-04-14 Thread Christopher McArthur
I have a component, that has a property of type Image. I need to assign
a new Image component to it. this is trivial to do in action script.
But, how do I do it in MXML?

 

Example:

mxml:

local:myContainerComponent id=containerComponent/

 

actionscript: 

var myImage:Image = new Image(myTestImage.jpg);

containerComponent.imageVar = myImage;

 

 

Is there anyway to do that creation of the image, and assignment purely
from MXML? The image cant be a child of anything else, so I cant just
declare it randomly somewhere in the same container.

 

 

For context, im using the Flash Component Kit, and the
myContainerComponent is a container exported from flash a
mx.flash.ContainerMovieClip. And it requires you to assign a component
to its content property. Ideally, id like to create and assign this
content component using mxml only.

 

 

 

 



[flexcoders] Component Lifecycle Change in Flex4?

2010-04-09 Thread Christopher McArthur
We are porting our project from Flex3 to Flex4.

 

One of the common patterns we used for our components in Flex3, was to
listen for the CreationComplete event, and then set some initial
properties on that components children (defined in MXML).

 

This worked fine in Flex3, however with the Flex4 SDK, these children
are often still null in the creationComplete. Is there a better place to
do this type of work now?

 

-ctm

 



[flexcoders] How do you tell when a new component is actually displayed?

2010-03-26 Thread Christopher McArthur
I need to be able to tell when a newly instantiated component, is
actually being rendered to the screen so you can see it.

 

Usually, I want to do this for complex screens. You navigate to the
screen and it shows a loading screen, once that's rendered, I do some
blocking action, like adding a complex list to the screen or doing some
calculations.

 

The problem Im having is there doesn't seem to be anyway to tell.
Listening for after the first updateDisplayList, it isnt rendered yet,
the first ExitFrame, it still isnt rendered, onAddedToStage, etc.
(trying callLaters after all of these).

Is there any way to tell when a new flex component is actually finished
being layed out and is being rendered?

 

-Christopher

 



RE: [flexcoders] Flex Builder Out of Memory Errors

2010-03-19 Thread Christopher McArthur
Yeah, I get this constantly too. I have 4GB of ram, and Flexbuilder
never goes above 700Mb, but still get the errors constantly.

 

Ive also tried everything I can find on google adjusting the memory
settings, tried values all over the place, and nothing, constnatly out
of memory crashes.

 

Our entire dev team gets this and we have a range of winXP, Macintosh,
vista, and windows 7.

 

Upgraded to Flash Builder 4, and no dice, still constant crashing =(

 

 

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of d9_tech
Sent: Friday, March 19, 2010 2:31 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Flex Builder Out of Memory Errors

 

  

It's pretty frustrating that Flex Builder regularly crashes with Out of
Memory errors during compile and sometimes even when design view is
refreshing. 

After searching for solutions and trying all sorts of memory
configurations in the Flex Builder config file, our dev team finally
gave up looking for a fix, hoping that things would get better in a
patch release. 

Unfortunately, they haven't. With each update of Flex Builder the out of
memory errors continue, sometimes manifesting as silent crashes where
Flex Builder just disappears. Even after we all got new Alienware
computers with 12 GB of RAM, Flex Builder still can't find enough
resources for whatever it's trying to do during compile. Today I
actually got three Out of Memory error dialogs at once, all piled on top
of each other. 

Can someone from the Flex team please shed light on what's going on and
let us know if there is a solution for this problem?

thanks,

Christian 



image001.jpgimage002.jpg

[flexcoders] Skinning Spark Components in Flash CS4?

2010-03-18 Thread Christopher McArthur
I cant find any information on how to skin Spark components from Flash, perhaps 
using something similiar to the Flash Component Kit for Flex3.
 
Here are two examples of Flex Components I would like to build in Flash.
 
1) A normal Button skin. Positioning the text label, and creating all of the 
up/down/over/etc states and transitions in Flash.
2) A container skin, that has some sort of flash graphic, with a container 
area, where an image is injected into this container from the Flex code.
 
Both of these are things that we currently do in Flex3. But, there is some 
jankiness there, and I like a lot of the stuff in Flex 4's spark, so would like 
to figure out how to do these things with the spark components.
 
Is this possible in Spark? If not what is the expected workflow for the more 
artist-driven components?
 
I did find this article on doing it through illustrator 
http://help.adobe.com/en_US/Flex/4.0/html/WS145DAB0B-A958-423f-8A01-12B679BA0CC7
 .html
But, that didnt make it clear to me how to make it work with a Button skin, or 
do the image injection I referred to earlier.
winmail.dat

RE: [flexcoders] help - code assist stopped working

2010-03-08 Thread Christopher McArthur
Im having the same probem.

 

Using Flash Builder 4 Beta 2 code assist does not work, and give the
same error as the OP.

 

Tried deleting the codemodel folder as Deane suggested, but
unfortunately, saw now no change.

 

Any other suggestions?

 

-Christopher

 

 

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Deane Venske
Sent: Thursday, March 04, 2010 2:31 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] help - code assist stopped working

 

  

You need to delete the following folder from your workspace:
.metadata\.plugins\com.adobe.flexbuilder.codemodel

That will make it work again. This happens so often to me that I've made
a batch file:
@echo off
REM The following will delete the prefs file in Flash Builder 4 Beta 2
that caused content assist to break
RMDIR
C:\Users\Deane\workspace\.metadata\.plugins\com.adobe.flexbuilder.codemo
del /s /q
@echo off
REM The following will delete the prefs file in Flash Builder 4 Beta 2
that caused content assist to break
RMDIR C:\Users\Deane\Adobe ColdFusion Builder
workspace\.metadata\.plugins\com.adobe.ide.coldfusion.appcodegeneration
/s /q
RMDIR C:\Users\Deane\Adobe ColdFusion Builder
workspace\.metadata\.plugins\com.adobe.ide.coldfusion.dictionary /s /q
RMDIR C:\Users\Deane\Adobe ColdFusion Builder
workspace\.metadata\.plugins\com.aptana.ide.editors.codeassist /s /q

Change that to your folders and it will work (I use CF Builder too)

You need to have the builders closed when running this.

Thanks,
Deane

On 3/4/2010 10:55 AM, Chris Sheffield wrote: 

  

I apologize. This is probably more of an Adobe Support issue,
but since I'm using beta 2 of FB4, I wasn't sure what kind of support is
currently available.

 

Anyway, I was working on a project yesterday and all of a sudden
my code assist stopped working in .as files. Still seems to work fine in
.mxml files, so not sure what's going on. Has anyone run into this? Is
there anything I can do? The error I receive is:

 

Content Assist did not complete normally.  Please see
the log for more information.

java.lang.NullPointerException

 

I haven't checked the log because I have no idea where it can be
found. Running on a Mac, btw. I suppose my next step is to simply
reinstall the product if I can't find another fix.

 

Thanks,

Chris

 

 

--

Chris Sheffield

Read Naturally, Inc.

www.readnaturally.com

 

 



RE: [flexcoders] My APP momentarily freezes I pass through my A.C. and create my objects.

2010-03-04 Thread Christopher McArthur
If you see my recent posts, I just had this exact same problem, check out the 
post I just made, if you need more details let me know, i can post the code I 
used.

Since flash is singlethreaded, you can NOT have a progress bar update in a 
loop. If you want to update a progress bar while you do work, you need to do a 
little bit of the work, wait a bit, do a little more, wait a bit, etc. 
Unfortunately, with the flex progress bar component you seem to have wait quite 
a while for it to update, so I ended up going with a custom one.



-Original Message-
From: flexcoders@yahoogroups.com on behalf of MonkeyIsland
Sent: Thu 3/4/2010 7:59 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] My APP momentarily freezes I pass through my A.C. and 
create my objects.
 
Hello everyone, 

I'm having an issue updating my progress bar, it only displays 100% once 
completed.

I've tried timers, callLaters, and anything else I could have thought of but 
then realized that my progress bar never updates because my app momentarily 
freezes as I pass through my ArrayCollection and create my objects... 

Is there a way to prevent my app from freezing?

Thanks :)

-David





RE: [flexcoders] Trouble with ProgressBar and manual updates.

2010-03-04 Thread Christopher McArthur
Unfortunately, same problem with callLater in either pattern.

I was able to solve my issue though, and I did so like this:

-I created my own simple custom component.
-It has one property percentComplete, when this property is set it updates 
the property and calls invalidateDisplayList().
-It ovverides updateDisplayList and uses the drawing API to draw a progress bar 
there based on percentComplete. And at the end of updateDisplayList It calls 
dispatchEvent.
-In my code, instead of listening for a timer, I listen for that event on my 
custom progress bar. Every time I hear the event, I addChild and update the 
percentComplete.

This works perfectly. Listening for ENTER_FRAME, EXIT_FRAME, RENDER, etc did 
not work, so I had to add the custom event.

-Christopher



-Original Message-
From: flexcoders@yahoogroups.com on behalf of Peeyush Tuli
Sent: Thu 3/4/2010 5:27 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Trouble with ProgressBar and manual updates.
 
what happens when you go the other way around... meaning that the add is
done before and progress bar update is sent to calllater?

On Wed, Mar 3, 2010 at 11:56 PM, Christopher McArthur 
cmcart...@riotgames.com wrote:



  callLater is a great suggestion, thank you. Unfortunately, was not
 helpful in this case. Even delaying the adds by a callLater does not allow
 the progressBar to update visually.



 *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On
 Behalf Of *Peeyush Tuli
 *Sent:* Tuesday, March 02, 2010 10:18 PM
 *To:* flexcoders@yahoogroups.com
 *Subject:* Re: [flexcoders] Trouble with ProgressBar and manual updates.





 it might be that all the processing is too much to be displayed in the same
 frame. So this might help you

 http://jimmyflex.blogspot.com/2007/11/dont-forget-power-of-calllater.html


 ~Peeyush
 http://www.mds.asia

 http://jimmyflex.blogspot.com/2007/11/dont-forget-power-of-calllater.html

  On Wed, Mar 3, 2010 at 6:53 AM, Christopher McArthur 
 cmcart...@riotgames.com wrote:



 Using Flex3 in AIR standalone application.



 I have a ton of children I need to add to a Canvas dynamically. When I do
 this, it takes a long time. So I wanted to display a loading bar to the
 user.



 I create a Timer, and every time the timer ticks, I update the loadingBar
 and I add the child. I also update a textField with the loading progress as
 a debug tool.



 What I find is that the textField _always_ updates correctly in realtime,
 but USUALLY the progress bar does NOT update at all until the entire
 sequence is finished. If I make the tick time long enough, then the progress
 bar works, but this time seems very dependent on performance of the
 individual machine.



 My question is, how do I know what the lowest possible tick time I can use
 to make the progress bar update correctly is? Why does it work with the Text
 field just fine? Or is there a better pattern I could be using to do this
 correctly?



 As you can see from the code, I tried some things like updateAfterEvent
 and invalidateDisplayList to see if I could get it to update faster, but
 those did not work (unless I set the tick time high).



 code here:



 *private* *var* pendingElementsToAdd:Array;

 *private* *var* totalElementstoAdd:int;

 *private* *static* *const* TIME_BETWEEN_ADDS:Number = 20;





 *private* *function* addElements(newElements:Array):*void*

 {

 *  this*.pendingElementsToAdd = newElements;

   *this*.totalElementstoAdd = *this*.pendingElementsToAdd.length;

   var newEventTimer:Timer = *new* Timer(TIME_BETWEEN_ADDS,
 newElements.length);

   newEventTimer.addEventListener(TimerEvent.TIMER,
 onTimerAddNewElement);

   newEventTimer.addEventListener(TimerEvent.TIMER_COMPLETE,
 finishAddingElements);

   newEventTimer.start();

 }



 *private* *function* onTimerAddNewElement(event:TimerEvent):*void*

 {

   *this*.loadingBar.setProgress(*this*.totalElementstoAdd
 - *this*.pendingElementsToAdd.length, *this*.totalElementstoAdd);

   *this*.loadingText.text = *Elements To Load: * + *this
 *.pendingElementsToAdd.length;



   event.updateAfterEvent();

   *this*.loadingBar.invalidateDisplayList();



   *this*.addChild(*this*.pendingElementsToAdd.pop());

 }

   





RE: [flexcoders] Need effect for ViewStack w/o changing the view

2010-03-04 Thread Christopher McArthur
when the content changes you can call


fadeIn.play([view1]);


if you want to make it fade out, then fade back in, make a new sequence effect 
that contains two fade effects. then call it like above.

-Original Message-
From: flexcoders@yahoogroups.com on behalf of joyh2002
Sent: Thu 3/4/2010 2:09 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Need effect for ViewStack w/o changing the view
 
Hi all,

I have a viewstack like this:

mx:ViewStack
  mx:Canvas id=view1 hideEffect={fadeOut} showEffect={fadeIn} /
  mx:Canvas id=view2 hideEffect={fadeOut} showEffect={fadeIn} /
/mx:ViewStack

The hideEffect and showEffect is triggered when I switch the views. How do I 
make the same effect when I change the contect of view1 (without changing the 
view from view2 to view1)? I'm already on view1, I change the content of view1, 
and need the same effect to signal the user that there are changes to the 
content. I don't want to create a new view.

Thanks,
Joy




RE: [flexcoders] Trouble with ProgressBar and manual updates.

2010-03-03 Thread Christopher McArthur
callLater is a great suggestion, thank you. Unfortunately, was not
helpful in this case. Even delaying the adds by a callLater does not
allow the progressBar to update visually.

 

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Peeyush Tuli
Sent: Tuesday, March 02, 2010 10:18 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Trouble with ProgressBar and manual updates.

 

  

it might be that all the processing is too much to be displayed in the
same frame. So this might help you

http://jimmyflex.blogspot.com/2007/11/dont-forget-power-of-calllater.htm
l


~Peeyush
http://www.mds.asia

http://jimmyflex.blogspot.com/2007/11/dont-forget-power-of-calllater.htm
l



On Wed, Mar 3, 2010 at 6:53 AM, Christopher McArthur
cmcart...@riotgames.com wrote:

  

Using Flex3 in AIR standalone application.

 

I have a ton of children I need to add to a Canvas dynamically. When I
do this, it takes a long time. So I wanted to display a loading bar to
the user. 

 

I create a Timer, and every time the timer ticks, I update the
loadingBar and I add the child. I also update a textField with the
loading progress as a debug tool.

 

What I find is that the textField _always_ updates correctly in
realtime, but USUALLY the progress bar does NOT update at all until the
entire sequence is finished. If I make the tick time long enough, then
the progress bar works, but this time seems very dependent on
performance of the individual machine.

 

My question is, how do I know what the lowest possible tick time I can
use to make the progress bar update correctly is? Why does it work with
the Text field just fine? Or is there a better pattern I could be using
to do this correctly?

 

As you can see from the code, I tried some things like
updateAfterEvent and invalidateDisplayList to see if I could get it
to update faster, but those did not work (unless I set the tick time
high).

 

code here:

 

private var pendingElementsToAdd:Array;

private var totalElementstoAdd:int;

private static const TIME_BETWEEN_ADDS:Number = 20;

 

  

private function addElements(newElements:Array):void

{

  this.pendingElementsToAdd = newElements;

  this.totalElementstoAdd = this.pendingElementsToAdd.length;

  var newEventTimer:Timer = new Timer(TIME_BETWEEN_ADDS,
newElements.length);

  newEventTimer.addEventListener(TimerEvent.TIMER,
onTimerAddNewElement);

  newEventTimer.addEventListener(TimerEvent.TIMER_COMPLETE,
finishAddingElements);

  newEventTimer.start();

}

 

private function onTimerAddNewElement(event:TimerEvent):void

{ 

  this.loadingBar.setProgress(this.totalElementstoAdd -
this.pendingElementsToAdd.length, this.totalElementstoAdd);

  this.loadingText.text = Elements To Load:  +
this.pendingElementsToAdd.length;

  

  event.updateAfterEvent();

  this.loadingBar.invalidateDisplayList();

  

  this.addChild(this.pendingElementsToAdd.pop());

}





RE: [flexcoders] Re: Does DataBinding to a function create a ChangeWatcher?

2010-03-02 Thread Christopher McArthur
Thanks for the video, took a while to get through, but answered my
questions throughly.

I am going to forward it to the other Flex developers on my team I found
it so helpful. Now, going to try to find other lectures by Labriola ;0

 

 

 

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of tntomek
Sent: Monday, March 01, 2010 12:09 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Does DataBinding to a function create a
ChangeWatcher?

 

  

Hi Chris,

Check this vid out:

http://tv.adobe.com/watch/360flex-conference/diving-in-the-data-binding-
waters-by-michael-labriola/

--- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
, Christopher McArthur cmcart...@... wrote:

 I am doing some performance/memory cleanup in my rather large
 application and looking to reduce the number of eventListeners and
 changeWatchers I have and was curious about this:
 
 say I have some function 
 
 
 
 function myFunc():String;
 
 
 
 that I data bind to an mx:Label's property label={myFunc()}
 
 
 
 I know this is a softbinding that is only udpated once, but is a
 ChangeWatcher created in this scenario?
 
 
 
 What about this one
 
 label={myFunc(this.myBindableVar)}
 
 
 
 Is there now a ChangeWatcher on myBindableVar?
 
 
 
 
 
 In general is it more efficient to use the
 invalidateProperties/commitProperties pattern instead of dataBinding
 when applicable, for the simple cases of binding to local properties?
 
 
 
 -Christopher




image001.jpgimage002.jpg

[flexcoders] Trouble with ProgressBar and manual updates.

2010-03-02 Thread Christopher McArthur
Using Flex3 in AIR standalone application.

 

I have a ton of children I need to add to a Canvas dynamically. When I
do this, it takes a long time. So I wanted to display a loading bar to
the user. 

 

I create a Timer, and every time the timer ticks, I update the
loadingBar and I add the child. I also update a textField with the
loading progress as a debug tool.

 

What I find is that the textField _always_ updates correctly in
realtime, but USUALLY the progress bar does NOT update at all until the
entire sequence is finished. If I make the tick time long enough, then
the progress bar works, but this time seems very dependent on
performance of the individual machine.

 

My question is, how do I know what the lowest possible tick time I can
use to make the progress bar update correctly is? Why does it work with
the Text field just fine? Or is there a better pattern I could be using
to do this correctly?

 

As you can see from the code, I tried some things like
updateAfterEvent and invalidateDisplayList to see if I could get it
to update faster, but those did not work (unless I set the tick time
high).

 

code here:

 

private var pendingElementsToAdd:Array;

private var totalElementstoAdd:int;

private static const TIME_BETWEEN_ADDS:Number = 20;

 

  

private function addElements(newElements:Array):void

{

  this.pendingElementsToAdd = newElements;

  this.totalElementstoAdd = this.pendingElementsToAdd.length;

  var newEventTimer:Timer = new Timer(TIME_BETWEEN_ADDS,
newElements.length);

  newEventTimer.addEventListener(TimerEvent.TIMER,
onTimerAddNewElement);

  newEventTimer.addEventListener(TimerEvent.TIMER_COMPLETE,
finishAddingElements);

  newEventTimer.start();

}

 

private function onTimerAddNewElement(event:TimerEvent):void

{ 

  this.loadingBar.setProgress(this.totalElementstoAdd -
this.pendingElementsToAdd.length, this.totalElementstoAdd);

  this.loadingText.text = Elements To Load:  +
this.pendingElementsToAdd.length;

  

  event.updateAfterEvent();

  this.loadingBar.invalidateDisplayList();

  

  this.addChild(this.pendingElementsToAdd.pop());

}



[flexcoders] Does DataBinding to a function create a ChangeWatcher?

2010-03-01 Thread Christopher McArthur
I am doing some performance/memory cleanup in my rather large
application and looking to reduce the number of eventListeners and
changeWatchers I have and was curious about this:

say I have some function 

 

function myFunc():String;

 

that I data bind to an mx:Label's property label={myFunc()}

 

I know this is a softbinding that is only udpated once, but is a
ChangeWatcher created in this scenario?

 

What about this one

label={myFunc(this.myBindableVar)}

 

Is there now a ChangeWatcher on myBindableVar?

 

 

In general is it more efficient to use the
invalidateProperties/commitProperties pattern instead of dataBinding
when applicable, for the simple cases of binding to local properties?

 

-Christopher

 

 



[flexcoders] A loading progress bar with a WindowedApplication?

2010-03-01 Thread Christopher McArthur
My AIR application is a standalone WindowedApplication. On startup, it
does not have a loading bar. Looking thorugh many flex articles and
example I see a lot of talk of the startup loading bar that works
automatically with Flex, however all of these are about web
applications. Does the WindowedApplication have one as well? If so can
anyone point me in the right direction for how to activate it?

 

-Christopher

 



RE: [flexcoders] A loading progress bar with a WindowedApplication?

2010-03-01 Thread Christopher McArthur
Hmm This throws an NPE in WindowedApplication's  override setVisible
because this._nativeWindow is null. (however this.nativeWindow is
valid).

 

Will try experimenting in a smaller test project.

 

 

 

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Alex Harui
Sent: Monday, March 01, 2010 2:34 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] A loading progress bar with a
WindowedApplication?

 

  

WindowedApplication's default behavior is to hide itself until the app
is completely ready.  If you want to see a progressbar, add the
following to the WindowedApplication tag:

preinitialize=visible=true


On 3/1/10 9:18 AM, Christopher McArthur cmcart...@riotgames.com
wrote:


 
 
   

My AIR application is a standalone WindowedApplication. On
startup, it does not have a loading bar. Looking thorugh many flex
articles and example I see a lot of talk of the startup loading bar that
works automatically with Flex, however all of these are about web
applications. Does the WindowedApplication have one as well? If so can
anyone point me in the right direction for how to activate it?
 
-Christopher
 

   




-- 
Alex Harui
Flex SDK Team
Adobe System, Inc.
http://blogs.adobe.com/aharui





[flexcoders] A certain .swc is breaking all of my other .swc containers?!!?

2009-12-14 Thread Christopher McArthur
I am using a flash component, exported into a .swc. These components are
all containers, with content areas, and in the flex code I put dynamic
images into the content area.

 

This works great! But recently, this suddenly broke. Instead of
rendering the content areas, it just renders a Fx symbol with a gray
background. This is what the content area looks like in flash, but
should always be invisible in Flex (not sure if I can attach images to
show exactly what I mean on here?).

 

So the weird thing was, the code doing this was never touched, and that
swc was never changed.

 

Finally tracked it down to reverting a completely unrelated, with no
overlap, different .swc in the project. If this *different* .swc is
compiled in, then it breaks ALL of the containers used in the other
.swc. I examined it very closely for naming conflicts and there are
none. I don't see any kind of error message anywhere (not sure where I
would see it though). Ive even stripped the broken .swc completely
clean and it still causes the problem.

 

Any clues out there to what this could be?

 

-Christopher

 



RE: [flexcoders] Re: How to know when a popup component is visible?

2009-12-07 Thread Christopher McArthur
I was unable to find any way to do this either after a lot of experiment I 
finally gave up. A callLater after creationComplete, or any other of a host of 
events that it looks like you tried as well still happens before the popup is 
visible as you found.
I ended up just doing a timer of about 1s after creation complete, which is 
annoying and hacky, but the only reliable solution I could find =(

-ctm
 


_
From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf 
Of Richard Rodseth
Sent: Monday, December 07, 2009 2:43 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Re: How to know when a popup component is visible?

  
Bump. Still trying to find a way to detect that a popup is visible.
On Mon, Nov 30, 2009 at 9:55 AM, Richard Rodseth rrods...@gmail.com wrote:
Yes, I have tried using callLater(). I was hoping there was an event I could 
tap into that got dispatched once the window is visible.

On Mon, Nov 30, 2009 at 9:21 AM, Chris zomgfore...@gmail.com wrote:
  
Everything is Flash is mostly single-threaded. You'll need to wait until after 
the window is visible to display start the encoding. Have you attempted using 
callLater() to start the encoding of the png a frame after the event is 
dispatched?

On Mon, Nov 30, 2009 at 9:47 AM, Richard Rodseth rrods...@gmail.com wrote:
  
This message hasn't showed up yet. Awaiting moderation? Any ideas?

On Wed, Nov 25, 2009 at 10:40 AM, Richard Rodseth rrods...@gmail.com wrote:
I had a thread going here about how to show progress before a potentially 
long-running but synchronous operation (in my case encoding a DisplayObject as  
a PNG or JPEG to add to an AlivePDF PDF.

Since I can't seem to force a busy cursor (ironic), one of the suggestions was 
to pop up a window before starting the encoding. But I've tried listening to 
creationComplete, render, show, addedToStage etc. etc., and in all cases the 
popup doesn't appear until the encoding is complete.

I was unable to find any event dispatched by the PopupManager either.

Help!






RE: [flexcoders] TitleList Sort Data - Animation

2009-12-01 Thread Christopher McArthur
I had the exact problem you did, and also someone asked a similiar question 
last week and I responded, I would check that response as it applies here as 
well

Basically, you are out of luck. ItemChangeEffect does not work with sort or 
filter. You will need to create your own custom component. Adobe has an example 
of this, the code  is pretty special case, but might help you get started 

http://www.adobe.com/devnet/flex/samples/flex_store/



___
From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf 
Of cbs1918
Sent: Tuesday, December 01, 2009 4:51 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] TitleList Sort Data - Animation

  
I want to have a TitleList with several elements. Then I want to have 
components to filter the data, when the data changes the items in the TitleList 
should animate into place. When I enable drag/drop on the TitleList and move 
elements the animation behaves as expected. However, when I sort/change the 
array the animation does not happen. After sorting the array I've found that if 
I call invalidateList() on the TitleList then the items update based on the new 
order of the array but they just appear in their new position they do not 
animate. What am I doing wrong or need to update? I've built a scaled down 
version and provided the code below.

Sample.mxml
---
?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; 
applicationComplete=initApp();
mx:Script
![CDATA[
[Bindable]
protected var _arrData:Array;

protected function initApp():void {
_arrData = new Array();
_arrData.push( new SampleDataModel(Item 1) );
_arrData.push( new SampleDataModel(Item 2) );
_arrData.push( new SampleDataModel(Item 3) );
_arrData.push( new SampleDataModel(Item 4) );
_arrData.push( new SampleDataModel(Item 5) );
_arrData.push( new SampleDataModel(Item 6) );
_arrData.push( new SampleDataModel(Item 7) );
_arrData.push( new SampleDataModel(Item 8) );
}

protected function sortItems():void {
_arrData.push(_arrData.shift());
titleLst.invalidateList();
}
]]
/mx:Script
mx:Button label=Sort Items click=sortItems(); /
mx:TileList id=titleLst dataProvider={_arrData} rowCount=2 
columnCount=2 itemRenderer=SampleDisplayItem width=250 height=100 
dragEnabled=true dragMoveEnabled=true dropEnabled=true
mx:itemsChangeEffect
mx:DefaultTileListEffect fadeOutDuration=250 fadeInDuration=350 
moveDuration=500 /
/mx:itemsChangeEffect
/mx:TileList
/mx:Application

SampleDataModel.as
--
package 
{
import flash.events.EventDispatcher;

[Bindable]
public class SampleDataModel extends EventDispatcher
{
public var title:String = ;

public function SampleDataModel(...rest) 
{
if (rest.length  0) {
title = rest[0];
}
}

}

}

SampleDisplayItem.mxml
--
?xml version=1.0 encoding=utf-8?
mx:Canvas xmlns:mx=http://www.adobe.com/2006/mxml; width=125 height=100
mx:Label text={data.title} /
/mx:Canvas



RE: [flexcoders] I've got a [Bindable] boolean var - can I setup a eventlistener on it?

2009-11-23 Thread Christopher McArthur
assuming your in the same class as changeme:

private var changemeWatcher:ChangeWatcher;

this.changemeWatcher = ChangeWatcher.watch(this, changeme, 
changemeChangedFunction);

this function will get called every time it changes:
private function changemeChangedFunction(event:PropertyChangeEvent):void

when you are done, make sure to uregister it with
this.changemeWatcher.unwatch();

__
From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf 
Of luvfotography
Sent: Friday, November 20, 2009 3:02 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] I've got a [Bindable] boolean var - can I setup a 
eventlistener on it?

  
I've declared a [Bindable] private var changeme:Boolean;

Is there a way to execute a function whenever this var changes?

thanks,



RE: [flexcoders] triggering itemsChangeEffect when using filters on an ArrayCollection's

2009-11-23 Thread Christopher McArthur
So I investigated this a lot myself a while ago, and you are pretty much out of 
luck. itemsChangeEffect does not work with refresh.

You can fake it a bit, by instead of doing a sort or a filter, manually 
adding/removing/moving elements one at a time in the list, which will trigger 
the itemsChangeEffect. Unfortunately, this only works for very simple changes, 
for complex changes the itemEffect will get confused and do the wrong thing.

For something like sorting a high scores list with a filter, this will probably 
NOT work.

To solve my very similar problem I had to create a brand new custom component 
that did this. I basically recreated the features of List that I needed and 
implemented the animation of them moving around using Move/Fade. The adobe 
sample that has a similar feature you are requesting also does not use 
itemChangeEffect, but instead implements a custom component like I did. 
http://www.adobe.com/devnet/flex/samples/flex_store/


as a side note, I was using itemChangeEffect a lot throughout my ap for the 
simpler lists, but I ended up encountering so many bugs and problems with it 
that I have now completely removed it from my application. Bummer, but 
hopefully they work better in Gumbo when I move to that.

-ctm


_
From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf 
Of fatmanchan2009
Sent: Friday, November 20, 2009 9:12 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] triggering itemsChangeEffect when using filters on an 
ArrayCollection's

  
Hey Guys

So what im basically doing is creating a List Component of players scores. The 
dataprovider is type ArrayCollection, and i have applied a sort filter on the 
collection so it sorts by players score, but when the filter is applied and the 
order of the collection changes, the itemsChangeEffect doesnt get triggered, so 
no effects occur. 

So thats the main problem, does anyone have a clue on how to go around this, or 
a fix for it? 

Cheers

Regards

SCHAN (fatmanchan2009)



RE: [flexcoders] dynamically show multiple containers?

2009-11-13 Thread Christopher McArthur
Ive done something like this before.

 

Here is how I might try to do it:

-First I would create a class called CityData, it would have a
stateName:String, and an cityNames:ArrayColleciton of strings.

-I would then create an ArrayCollection of cityData and fill it will all
of my data.

 

-I would then create filters for cityData using filterFunction and set
the filterFuntion based on what checkboxes were checked, to filter in
and out the cities needed.

-I would update the filterFunction and refresh cityData based on changed
events from the checkboxes. 

 

-then I would create an mx:List with the cityData as the dataprovider
and a custom itemRenderer. 

-This itemrenderer would have a label databound to the data.stateName, 

-the item render would also have  an mx:List with its dataprovider
databound to data. cityNames.

 

does that make sense?

 

You could even generate the checkbox list by using a List, with its
dataprovider set to an unfiltered copy of cityData, with an itemRender
that displays a checkbox (with the label of data.stateName).

 

 

-ctm

 

 

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of coder3
Sent: Friday, November 13, 2009 2:30 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] dynamically show multiple containers?

 

  


HI All,

There are ways to show different Flex containers, for examples, states
or
viewstacks.

my problems, i have multiple combinations, 

for example, i need to show a list of cities based on a list of check
boxes
of states, say i have a list of 

AZ, CA, WA, 
if i select all, it shows major cities of three states, 
then if i unselect CA, it only shows cities of AZ and WA,
then if i select CA and unselect WA, it shows cities of AZ and CA,

what's the best way to do it?

thanks!

C

-- 
View this message in context: 
http://old.nabble.com/dynamically-show-multiple-containers--tp26344571p2
6344571.html
Sent from the FlexCoders mailing list archive at Nabble.com.



image001.jpgimage002.jpg

RE: [flexcoders] Why never create an item renderer?

2009-09-04 Thread Christopher McArthur
Can anyone recommend any good reading material on this? Im having some
memory issues with my itemrenderers lately ;)

 

 

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Alex Harui
Sent: Thursday, September 03, 2009 11:53 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Why never create an item renderer?

 

  

It is good enough if you shipped it and got paid J

 

If you want to post the code for a renderer, we can offer opinions on
the pros and cons of your implementation.  It might be good education
for many.  I don't have time to judge dozens of renderers so we can just
start with one of yours and discuss it.  There is usually a trade-off of
ease of programming vs performance and memory optimization.  The smaller
and faster you want it to be, the more work you have to do.  If you're
only gonna have 7 renderers on screen, it doesn't matter as much as if
you are creating DataGrid renderers for a 20x20 grid.

 

Alex Harui

Flex SDK Developer

Adobe Systems Inc. http://www.adobe.com/ 

Blog: http://blogs.adobe.com/aharui

 

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Wesley Acheson
Sent: Thursday, September 03, 2009 3:29 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Why never create an item renderer?

 

  

I've created a few. I've recreated a few working ones because I want to
understand the framework better. I guess my problem is how do I know if
the item renderers i've created are Correct.  I've far too often seen
programming as a religion. I've just as often seen people just make
things work. 

I can't stand by either of these sometimes you need things to just work,
however if you don't worry about practices you've got unmaintainable
code.

So how do I know if what I've written is good enough.

Regards,

Wesley Acheson

On Thu, Sep 3, 2009 at 9:38 PM, Tracy Spratt tr...@nts3rd.com wrote:

 

It is not always given as advice.  I give that when I see that a
developer does not have his head around the issues.  It is usually quite
obvious when that is the case.

 

I think it is better advice than RTFM.  An example will get a newbie
further faster.

 

When that advice does not apply to you, you will know it.

 

Tracy Spratt,

Lariat Services, development services available



From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Wesley Acheson
Sent: Thursday, September 03, 2009 2:36 PM
To: flexcoders
Subject: [flexcoders] Why never create an item renderer?

 

  

I've seen this adivse a lot reciently on the list. Don't create an item
renderer modify an existing example.  I don't really understand why. I
mean their not that difficult to get your head arround so long as you
reset all internal variables that need to be reset.

Why is this always given as advise?

Regards,

Wesley Acheson

 

 



image001.jpgimage002.jpg