[flexcoders] How To Disable Module Screen Updates....

2012-04-09 Thread jamesfin
We have up to 30 small modules that are getting loaded at startup and notice 
that the accumulative perceived loading effect is slow when creating the 
modules via...

_module.factory.create() as IVisualElement;

... as all of the modules are competing for CPU to draw themselves.

So, is there a way to disable all component rendering (i.e. screen updates) in 
each module until the user selects focus for each particular container/module?  
There's no reason to draw everything at the same time when all of them can't be 
seen at the same time.  

Imagine each module is added to a tab in tabnavigator and that only the first 
visible tab/module has been rendered, when any other tab is selected, the 
module then and only then renders itself.





[flexcoders] Re: How To Disable Module Screen Updates....

2012-04-09 Thread jamesfin
Thanks Alex!  We were hoping for that elusive disableNow function to add to 
the invalidateNow(), validateNow() family. ;)



--- In flexcoders@yahoogroups.com, Alex Harui aharui@... wrote:

 Don't call factory.create() until the first time you go to that tab.
 
 
 On 4/9/12 11:16 AM, jamesfin james.alan.finnigan@... wrote:
 
 
 
 
 
 
 We have up to 30 small modules that are getting loaded at startup and notice 
 that the accumulative perceived loading effect is slow when creating the 
 modules via...
 
 _module.factory.create() as IVisualElement;
 
 ... as all of the modules are competing for CPU to draw themselves.
 
 So, is there a way to disable all component rendering (i.e. screen updates) 
 in each module until the user selects focus for each particular 
 container/module?  There's no reason to draw everything at the same time when 
 all of them can't be seen at the same time.
 
 Imagine each module is added to a tab in tabnavigator and that only the first 
 visible tab/module has been rendered, when any other tab is selected, the 
 module then and only then renders itself.
 
 
 
 
 
 
 --
 Alex Harui
 Flex SDK Team
 Adobe Systems, Inc.
 http://blogs.adobe.com/aharui





[flexcoders] Re: Modules, TabNavigator, Force Render...

2012-02-06 Thread jamesfin
Follow-up #1...

Use a simple 100ms timer so each tab is selected programmatically.  Each tab is 
rendered normally although the tab stays visible throughout the rendering 
process and switches to the next tab when completed.  A workaround is to hide 
the tabnavigator and restore visibility at the end.

Because the tabnav isn't visible but still renders each tab, there must be a 
way to manually force each tab to render the contents.  Hack or otherwise.






 Using a simple two tab TabNavigator, two modules are loaded via 
 ModuleManager.load.  A bitmap is being generated for each tab as a preview to 
 what content exists on each tab.
 
 The first visible tab displays the bitmap normally.  The second tab (not yet 
 clicked on or shown) bitmap comes up empty as it would appear as if it hasn't 
 rendered yet.
 
 The creationPolicy for all the associated containers is set to all.  
 
 Clicking on the second tab instantly shows the content as expected.
 
 Is there a manual method to forcing the second tab to render itself so that 
 the preview bitmap can be generated without having to click on the second tab?
 
 As a side-solution, if each tab (3 tabs in this scenario) are selected 
 programmatically for one second, will that force a render to occur even 
 though the next programmatically selected tab (tab three) has also been 
 selected?
 
 i.e.
 
 first tab is visible
 second tab is programmatically selected
 wait 1 second
 third tab is programmatically selected





[flexcoders] Modules, TabNavigator, Force Render...

2012-02-05 Thread jamesfin
Using a simple two tab TabNavigator, two modules are loaded via 
ModuleManager.load.  A bitmap is being generated for each tab as a preview to 
what content exists on each tab.

The first visible tab displays the bitmap normally.  The second tab (not yet 
clicked on or shown) bitmap comes up empty as it would appear as if it hasn't 
rendered yet.

The creationPolicy for all the associated containers is set to all.  

Clicking on the second tab instantly shows the content as expected.

Is there a manual method to forcing the second tab to render itself so that the 
preview bitmap can be generated without having to click on the second tab?

As a side-solution, if each tab (3 tabs in this scenario) are selected 
programmatically for one second, will that force a render to occur even though 
the next programmatically selected tab (tab three) has also been selected?

i.e.

first tab is visible
second tab is programmatically selected
wait 1 second
third tab is programmatically selected














[flexcoders] SWF Management...

2012-02-05 Thread jamesfin
A module is being loaded by a simple ModuleManager.load.

In debug mode, there is output like this...

[Unload SWF] View.swf/[[DYNAMIC]]/307 - 632 bytes after decompression
[Unload SWF] View.swf/[[DYNAMIC]]/308 - 632 bytes after decompression
[Unload SWF] View.swf/[[DYNAMIC]]/309 - 632 bytes after decompression
[Unload SWF] View.swf/[[DYNAMIC]]/310 - 632 bytes after decompression
[Unload SWF] View.swf/[[DYNAMIC]]/311 - 632 bytes after decompression

and

[SWF] View.swf/[[DYNAMIC]]/337 - 632 bytes after decompression
[SWF] View.swf/[[DYNAMIC]]/338 - 632 bytes after decompression
[SWF] View.swf/[[DYNAMIC]]/339 - 632 bytes after decompression
[SWF] View.swf/[[DYNAMIC]]/340 - 632 bytes after decompression
[SWF] View.swf/[[DYNAMIC]]/341 - 632 bytes after decompression

when interacting with the application.


Is this normal and why the all the loading and unloading messages?




[flexcoders] Re: You are the product

2011-12-28 Thread jamesfin
As a devoted Flex Developer, Flex has been very, very good to me.  I also know 
that technology advancements require change (I say additions).  I can remember 
when programming in 8086 assembler wondering when I wouldn't need to use that 
silly old segment/offset hack, er, architecture.  Segment/offset was finally 
rescued years later but after writing millions of lines of code.  To adapt, I 
had to bite the bullet and added the newer architectures to my list of skills.

Now here I am again, ahem, 30 years later doing the same thing.  Almost six 
years invested into Flex and voila, gotta add something new to the resume to 
keep up.  For me, it's not as much a change as valuing it as an opportunity to 
add even more skills to my toolbox.

I've spent some time in the past month evaluating JS equivalents to Flex.  
Pickins' are slim but Sencha seemed to land nicely in my spacious Flex 
townhouse.  If you are considering adding something to your toolbox, consider 
Sencha.  It's as close to Flex as you're probably going to get with some nice 
MVC abilities for instance.  I've written a couple of demo apps. and rarely 
have to deal with the DOM.  Yes, that's right folks, none of that JS - DOM 
yakkity-yak.  They even offer a Screen Designer to eliminate the screen layout 
guesswork.

If you can't tell, I'm happy with Sencha thus far and can now say that I'm a 
Flex Developer AND a Sencha Developer.  Give it a whirl or any try any other JS 
solution.  Your resume will only grow. ;)

  





[flexcoders] Flex, HTML5, Javascript...oh my!

2011-10-13 Thread jamesfin
As a devoted flex developer of over five years now, I'm getting the nudge by 
management to get as comfortable with HTML5/Javascript as I currently am with 
MXML/Actionscript.  Not my decision.

That said, I figured this forum would be better suited to answer a few 
questions about html5/javascript rather than a endure throught a few 
flash-hater filled javascript forums. ;)

Knowing the following about common flex development practices, what are the 
analogs with flex when using javascript, if any at all?

FlashBuilder = ? (i.e. dreamweaver?)
MXML = HTML
Actionscript = Javascript
RobotLegs = ?
AS3Signals = ?
Others, feel free to contribute...


Also,
Using Robotlegs affords many comforts towards MVC development practices.  In 
that context, can other analogs be made in HTML5/Javascript where separate 
files are used for each of these areas?  Links and/or examples would be great.

View = ?
Mediator = ?
Service = ?
Model = ?
Controller = ?
Dependency Injection = ?
Signals = ?

It would appear as if SproutCore shares some of the attributes we enjoy in Flex 
but would like to hear what Javascripts frameworks are most friendly to Flex 
Developers.


Thanks in advance!






[flexcoders] IE8/ActiveX FlashPlayer Bug?

2010-07-02 Thread jamesfin
I believe there is an anomaly within the ActiveX Flash Player that is causing a 
1009 error when trying to center a simple popup.

This logic runs fine on all non-IE OSX and Windows browsers thus causing me to 
think it's specific to ActiveX Flash.

One thing that may be unique here is that we are using 
loadForCompatibility=true.  The loadForCompatibility property specifies whether 
the sub-application is loaded into a peer ApplicationDomain as the parent (when 
set to true), or into a child ApplicationDomain (when set to false).

Using 3.5SDK with Flash Player (IE) 10.1.53.64.



Parent Application Loading code...

swf = new SWFLoader();
parentApp.rawChildren.addChild(swf);
swf.visible = false;
swf.includeInLayout = false;

swf.addEventListener(Event.COMPLETE, swfAppComplete);
swf.addEventListener(IOErrorEvent.IO_ERROR, ioError);
swf.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityError);

swf.loadForCompatibility = true;





Parent Application later calls into SWF...

var callFunction:Function = (swf.content as 
Object).application[_commonFunction];
callFunction(_param);





Loaded SWF Code trys to display a Popup...

var foo:fooEdit = PopUpManager.createPopUp(systemManager.getSandboxRoot(), 
fooEdit, true) as fooEdit;
foo.fooID = 123;
PopUpManager.centerPopUp(bldg);



When the PopUpManager.centerPopUp method is called, it fails at...

TypeError: Error #1009: Cannot access a property or method of a null object 
reference.
at mx.managers::PopUpManagerImpl/findPopupInfoByOwner()
at mx.managers::PopUpManagerImpl/centerPopUp()
at mx.managers::PopUpManager$/centerPopUp()



Since these same SWF's run fine in non-IE environments, is there something 
unique about the ActiveX flash player that might cause this failure?

What other kinds of information would be needed to further evaluate a cause?










[flexcoders] Re: IE8/ActiveX FlashPlayer Bug?

2010-07-02 Thread jamesfin
Follow-up...

As a test, I set loadForCompatibility=false.  Voila, everything works.  This 
indicates a clear defect in the loadForCompatibility functionality with the 
ActiveX Flash Player.  However, I will no longer be able to use cross-SDK SWF's 
in parallel. ;(





--- In flexcoders@yahoogroups.com, jamesfin james.alan.finni...@... wrote:

 I believe there is an anomaly within the ActiveX Flash Player that is causing 
 a 1009 error when trying to center a simple popup.
 
 This logic runs fine on all non-IE OSX and Windows browsers thus causing me 
 to think it's specific to ActiveX Flash.
 
 One thing that may be unique here is that we are using 
 loadForCompatibility=true.  The loadForCompatibility property specifies 
 whether the sub-application is loaded into a peer ApplicationDomain as the 
 parent (when set to true), or into a child ApplicationDomain (when set to 
 false).
 
 Using 3.5SDK with Flash Player (IE) 10.1.53.64.
 
 
 
 Parent Application Loading code...
 
 swf = new SWFLoader();
 parentApp.rawChildren.addChild(swf);
 swf.visible = false;
 swf.includeInLayout = false;
 
 swf.addEventListener(Event.COMPLETE, swfAppComplete);
 swf.addEventListener(IOErrorEvent.IO_ERROR, ioError);
 swf.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityError);
 
 swf.loadForCompatibility = true;
 
 
 
 
 
 Parent Application later calls into SWF...
 
 var callFunction:Function = (swf.content as 
 Object).application[_commonFunction];
 callFunction(_param);
 
 
 
 
 
 Loaded SWF Code trys to display a Popup...
 
 var foo:fooEdit = PopUpManager.createPopUp(systemManager.getSandboxRoot(), 
 fooEdit, true) as fooEdit;
 foo.fooID = 123;
 PopUpManager.centerPopUp(bldg);
 
 
 
 When the PopUpManager.centerPopUp method is called, it fails at...
 
 TypeError: Error #1009: Cannot access a property or method of a null object 
 reference.
   at mx.managers::PopUpManagerImpl/findPopupInfoByOwner()
   at mx.managers::PopUpManagerImpl/centerPopUp()
   at mx.managers::PopUpManager$/centerPopUp()
 
 
 
 Since these same SWF's run fine in non-IE environments, is there something 
 unique about the ActiveX flash player that might cause this failure?
 
 What other kinds of information would be needed to further evaluate a cause?





[flexcoders] Re: IE8/ActiveX FlashPlayer Bug?

2010-07-02 Thread jamesfin
Sorry bout that...foo is being passed...

var foo:fooEdit = PopUpManager.createPopUp(systemManager.getSandboxRoot(), 
fooEdit, true) as fooEdit;
foo.fooID = 123;
PopUpManager.centerPopUp(foo);


The loaded SWF is also 3.5.


Thanks!




--- In flexcoders@yahoogroups.com, Alex Harui aha...@... wrote:

 Is the loaded SWF also built with 3.5?
 
 
 On 7/2/10 10:18 AM, jamesfin james.alan.finni...@... wrote:
 
 
 
 
 
 
 Follow-up...
 
 As a test, I set loadForCompatibility=false.  Voila, everything works.  This 
 indicates a clear defect in the loadForCompatibility functionality with the 
 ActiveX Flash Player.  However, I will no longer be able to use cross-SDK 
 SWF's in parallel. ;(
 
 --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , 
 jamesfin james.alan.finnigan@ wrote:
 
  I believe there is an anomaly within the ActiveX Flash Player that is 
  causing a 1009 error when trying to center a simple popup.
 
  This logic runs fine on all non-IE OSX and Windows browsers thus causing me 
  to think it's specific to ActiveX Flash.
 
  One thing that may be unique here is that we are using 
  loadForCompatibility=true.  The loadForCompatibility property specifies 
  whether the sub-application is loaded into a peer ApplicationDomain as the 
  parent (when set to true), or into a child ApplicationDomain (when set to 
  false).
 
  Using 3.5SDK with Flash Player (IE) 10.1.53.64.
 
 
 
  Parent Application Loading code...
 
  swf = new SWFLoader();
  parentApp.rawChildren.addChild(swf);
  swf.visible = false;
  swf.includeInLayout = false;
 
  swf.addEventListener(Event.COMPLETE, swfAppComplete);
  swf.addEventListener(IOErrorEvent.IO_ERROR, ioError);
  swf.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityError);
 
  swf.loadForCompatibility = true;
 
 
 
 
 
  Parent Application later calls into SWF...
 
  var callFunction:Function = (swf.content as 
  Object).application[_commonFunction];
  callFunction(_param);
 
 
 
 
 
  Loaded SWF Code trys to display a Popup...
 
  var foo:fooEdit = PopUpManager.createPopUp(systemManager.getSandboxRoot(), 
  fooEdit, true) as fooEdit;
  foo.fooID = 123;
  PopUpManager.centerPopUp(bldg);
 
 
 
  When the PopUpManager.centerPopUp method is called, it fails at...
 
  TypeError: Error #1009: Cannot access a property or method of a null object 
  reference.
  at mx.managers::PopUpManagerImpl/findPopupInfoByOwner()
  at mx.managers::PopUpManagerImpl/centerPopUp()
  at mx.managers::PopUpManager$/centerPopUp()
 
 
 
  Since these same SWF's run fine in non-IE environments, is there something 
  unique about the ActiveX flash player that might cause this failure?
 
  What other kinds of information would be needed to further evaluate a cause?
 
 
 
 
 
 
 
 --
 Alex Harui
 Flex SDK Team
 Adobe System, Inc.
 http://blogs.adobe.com/aharui





[flexcoders] Re: IE8/ActiveX FlashPlayer Bug?

2010-07-02 Thread jamesfin
Tried this and got the same 1009 error in the same place.



--- In flexcoders@yahoogroups.com, Alex Harui aha...@... wrote:

 Try passing in just systemManager instead of systemManager.getSandboxRoot
 
 
 On 7/2/10 11:11 AM, jamesfin james.alan.finni...@... wrote:
 
 
 
 
 
 
 Sorry bout that...foo is being passed...
 
 var foo:fooEdit = PopUpManager.createPopUp(systemManager.getSandboxRoot(), 
 fooEdit, true) as fooEdit;
 foo.fooID = 123;
 PopUpManager.centerPopUp(foo);
 
 The loaded SWF is also 3.5.
 
 Thanks!
 
 --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , 
 Alex Harui aharui@ wrote:
 
  Is the loaded SWF also built with 3.5?
 
 
  On 7/2/10 10:18 AM, jamesfin james.alan.finnigan@ wrote:
 
 
 
 
 
 
  Follow-up...
 
  As a test, I set loadForCompatibility=false.  Voila, everything works.  
  This indicates a clear defect in the loadForCompatibility functionality 
  with the ActiveX Flash Player.  However, I will no longer be able to use 
  cross-SDK SWF's in parallel. ;(
 
  --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com  
  mailto:flexcoders%40yahoogroups.com , jamesfin james.alan.finnigan@ 
  wrote:
  
   I believe there is an anomaly within the ActiveX Flash Player that is 
   causing a 1009 error when trying to center a simple popup.
  
   This logic runs fine on all non-IE OSX and Windows browsers thus causing 
   me to think it's specific to ActiveX Flash.
  
   One thing that may be unique here is that we are using 
   loadForCompatibility=true.  The loadForCompatibility property specifies 
   whether the sub-application is loaded into a peer ApplicationDomain as 
   the parent (when set to true), or into a child ApplicationDomain (when 
   set to false).
  
   Using 3.5SDK with Flash Player (IE) 10.1.53.64.
  
  
  
   Parent Application Loading code...
  
   swf = new SWFLoader();
   parentApp.rawChildren.addChild(swf);
   swf.visible = false;
   swf.includeInLayout = false;
  
   swf.addEventListener(Event.COMPLETE, swfAppComplete);
   swf.addEventListener(IOErrorEvent.IO_ERROR, ioError);
   swf.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityError);
  
   swf.loadForCompatibility = true;
  
  
  
  
  
   Parent Application later calls into SWF...
  
   var callFunction:Function = (swf.content as 
   Object).application[_commonFunction];
   callFunction(_param);
  
  
  
  
  
   Loaded SWF Code trys to display a Popup...
  
   var foo:fooEdit = 
   PopUpManager.createPopUp(systemManager.getSandboxRoot(), fooEdit, true) 
   as fooEdit;
   foo.fooID = 123;
   PopUpManager.centerPopUp(bldg);
  
  
  
   When the PopUpManager.centerPopUp method is called, it fails at...
  
   TypeError: Error #1009: Cannot access a property or method of a null 
   object reference.
   at mx.managers::PopUpManagerImpl/findPopupInfoByOwner()
   at mx.managers::PopUpManagerImpl/centerPopUp()
   at mx.managers::PopUpManager$/centerPopUp()
  
  
  
   Since these same SWF's run fine in non-IE environments, is there 
   something unique about the ActiveX flash player that might cause this 
   failure?
  
   What other kinds of information would be needed to further evaluate a 
   cause?
  
 
 
 
 
 
 
  --
  Alex Harui
  Flex SDK Team
  Adobe System, Inc.
  http://blogs.adobe.com/aharui
 
 
 
 
 
 
 
 --
 Alex Harui
 Flex SDK Team
 Adobe System, Inc.
 http://blogs.adobe.com/aharui





[flexcoders] Panel Container Gradients...

2010-06-18 Thread jamesfin
Using Flex4, I'd like some suggestions on how to paint the Panel Container 
title bar area with a gradient rather than a single color choice.

It would appear that there is a 'chrome-color' style but only takes a single 
color value.







[flexcoders] trace(trace not working);

2010-05-28 Thread jamesfin
I have the Flex4 Eclipse Plugin installed and I'm noticing that the trace 
statement seems to be ignored.  A breakpoint can't be put on any trace 
statement nor does any output appear. 

My Flex 3 Eclipse Plugin works great.

I can debug in both versions no problem.

trace(waiting for your responses);



[flexcoders] Re: trace(trace not working);

2010-05-28 Thread jamesfin
trace(no);

--- In flexcoders@yahoogroups.com, Brendan Meutzner bmeutz...@... wrote:

 Do you use the compiler argument -optimize=true ?
 
 
 
 On May 28, 2010, at 10:59 AM, jamesfin  
 james.alan.finni...@... wrote:
 
  I have the Flex4 Eclipse Plugin installed and I'm noticing that the  
  trace statement seems to be ignored. A breakpoint can't be put on  
  any trace statement nor does any output appear.
 
  My Flex 3 Eclipse Plugin works great.
 
  I can debug in both versions no problem.
 
  trace(waiting for your responses);
 
 





[flexcoders] Flash Player Detection / ServerSide

2010-05-25 Thread jamesfin
Does anyone have any knowledge of how to detect whether or not a simple REST 
call to a server (java/php/etc.) is from the Flash Player (flex app)?

It would appear that application/x-shockwave-flash can be detected by the 
server in the HTTP_ACCEPT header as long as the type is defined in the html 
wrapper like this...

embed src=${swf}.swf quality=high bgcolor=${bgcolor}
width=${width} height=${height} 
name=${application} align=middle
play=true
loop=false
quality=high
allowScriptAccess=sameDomain
type=application/x-shockwave-flash

pluginspage=http://www.adobe.com/go/getflashplayer;
/embed



Outside of this methodology, is there another approach or perhaps something the 
flash player sends along with each request?


I saw this reference as well so any additional comments are welcome.

The HTTP_X_FLASH_VERSION HTTP field, which returns the players
FLASH version in a server side script, only appears to be available when 
opening a .swf in Internet Explorer.

Nothing is returned for HTTP_X_FLASH_VERSION
when opening the same .swf in Google Chrome
or Firefox 3+. 









[flexcoders] Flash Player Detection / ServerSide

2010-05-25 Thread jamesfin
Does anyone have any knowledge of how to detect whether or not a simple REST 
call to a server (java/php/etc.) is from the Flash Player (flex app)?

It would appear that application/x-shockwave-flash can be detected by the 
server in the HTTP_ACCEPT header as long as the type is defined in the html 
wrapper like this...

embed src=${swf}.swf quality=high bgcolor=${bgcolor}
width=${width} height=${height} 
name=${application} align=middle
play=true
loop=false
quality=high
allowScriptAccess=sameDomain
type=application/x-shockwave-flash

pluginspage=http://www.adobe.com/go/getflashplayer;
/embed



Outside of this methodology, is there another approach or perhaps something the 
flash player sends along with each request?


I saw this reference as well so any additional comments are welcome.

The HTTP_X_FLASH_VERSION HTTP field, which returns the players
FLASH version in a server side script, only appears to be available when 
opening a .swf in Internet Explorer.

Nothing is returned for HTTP_X_FLASH_VERSION
when opening the same .swf in Google Chrome
or Firefox 3+. 









[flexcoders] Thoughts on things other than Flash...

2010-05-03 Thread jamesfin
Based upon the Steve Jobs thread, we all have an opinion on what we believe is 
the Holy Grail for creating/deploying cloud applications.

This begs the question...In a perfect world (a do-over), what would the 
perfect cloud-based application development platform/deployment architecture 
look like?  We know it isn't HTML5/JS or Flash.











[flexcoders] Re: how to handle remote requests the never return or get lost?

2010-05-03 Thread jamesfin

I agree with Rick.  For all net calls, I have a timer going and a simple queue 
that is populated when sending each request.  When and if they return sometime 
later, they are removed from the queue.  If requests aren't received by some 
set timeout, they are ignored.

I employ the use of tokens for each request so I know if I should ignore them 
or not if they are expired by my timeout.  You could also log the failure to 
the server or trace if you want to track them.

james
 

--- In flexcoders@yahoogroups.com, Rick Genter rick.gen...@... wrote:

 On Mon, May 3, 2010 at 1:14 PM, Baz li...@... wrote:
 
 
 
  If you send a request to a web service, and for some reason that request
  never returns because it got lost on the net, or some other failure. What
  strategies do people employ on the flex side to handle that situation?
  FaultEvent wouldn't fire in this case, because there are no known faults
  yet. Perhaps, people employ some timeout functionality on their remote
  listeners?
 
  Cheers,
  Baz
 
 
 Do you use a URLRequest/URLLoader to place your request? I think if you
 listen for an IOErrorEvent.IO_ERROR, one gets raised if the request times
 out at the HTTP level. If the request gets to the server but the server just
 takes too long to respond, then I think you'll have to add some sort of
 timer.
 -- 
 Rick Genter
 rick.gen...@...





[flexcoders] Re: XMLListCollection DataGrid Performance vs Any Other DataProvider Type

2010-04-30 Thread jamesfin


This code will convert for you...

You need to replace the xmllist.myxmldata with your own xml structure names.


private function convertXmlToArrayCollection( myxml:String 
):ArrayCollection
{
var xml:XMLDocument = new XMLDocument( myxml );

var decoder:SimpleXMLDecoder = new 
SimpleXMLDecoder();
var data:Object = decoder.decodeXML( xml );

var array:Array = 
ArrayUtil.toArray(data.xmllist.myxmldata);

return new ArrayCollection( array );
}


A quick follow-up after I made this tweak to use objects vs xml.

In my case, performance increased by about 20% when scrolling on a 24 monitor 
browser full-size by reducing the number of renderers from 10 to 3.  I then 
pre-translated the original xml data in the conversion so that I didn't need to 
do it with a label function.  

Performance is now acceptable in full-screen (24) mode.

Bottom-line, avoid renderers.  Label functions are better but are still taxing 
on the performance if there is a bunch of computing going on in those 
functions.  Pre-render data when converting from xml to objects.







--- In flexcoders@yahoogroups.com, Alex Harui aha...@... wrote:

 I don't know of any links off-hand.  I would simply create a class with the 
 set of properties you are interested in, then take the XML and parse it into 
 instances of that class.
 
 You can try to get XMLDecoder to do it, but sometimes it is more efficient 
 just to write your own converter.
 
 
 On 4/29/10 7:50 PM, Angelo Anolin angelo_ano...@... wrote:
 
 
 
 
 
 
 Any link to show us some samples?
 
 My data is coming from a .NET backend and most of it are in XML format and 
 parsed into XMLListCollection.
 
 Would appreciate some more info on this.
 
 THanks.
 
 
 From: Alex Harui aha...@...
 To: flexcoders@yahoogroups.com flexcoders@yahoogroups.com
 Sent: Wed, 28 April, 2010 21:49:52
 Subject: Re: [flexcoders] XMLListCollection DataGrid Performance vs Any Other 
 DataProvider Type
 
 
 
 
 Convert the XML to Class instances.
 
 
 On 4/28/10 10:06 AM, jamesfin james.alan.finnigan @gmail.com wrote:
 
 
 
 
 
 
 Here's the scenario...
 
 Simple datagrid with XMLListCollection data provider.
 
 Average collection size is 200 rows of XML (shown below)
 
 10 columns in the datagrid with a unique item renderer for each.  1 Column 
 can display 1 of 10 embedded images depending on an xml attribute.
 
 AS3-only Renderers are highly optimized.
 
 Average visible rows = 30 (simultaneously visible rows / meaning at least 300 
 renderers being recycled when scrolling?
 
 Typical XML row data
 
 foodata fooid=4997 fooid2=0 fooid3=2909 foot=9 startdate=2010-04-09 
 13:45:00 enddate=2010-04-09 14:45:00 foost=1 fooname=New Foobar 
 foosub=More Foobardata fooloc=false fooonly=false
 /foodata
 
 When all said and done being loaded, vertical scrolling is noticeably slow on 
 a new iMac (Safari or Firefox with latest FlashPlayer) compared to a stripped 
 down non-XML data provider version which scrolls quickly.
 
 Googling consensus shows that XMLListCollection is not the optimal 
 dataprovider in this scenario and that XML in general is not the best choice 
 if it can be avoided.
 
 Can anybody shed any light on a better way to improve scrolling performance 
 based upon this scenario?
 
 Thanks in advance.
 
 
 
 
 
 
 --
 Alex Harui
 Flex SDK Team
 Adobe System, Inc.
 http://blogs.adobe.com/aharui





[flexcoders] XMLListCollection DataGrid Performance vs Any Other DataProvider Type

2010-04-28 Thread jamesfin
Here's the scenario...

Simple datagrid with XMLListCollection data provider.  

Average collection size is 200 rows of XML (shown below)

10 columns in the datagrid with a unique item renderer for each.  1 Column can 
display 1 of 10 embedded images depending on an xml attribute.

AS3-only Renderers are highly optimized.

Average visible rows = 30 (simultaneously visible rows / meaning at least 300 
renderers being recycled when scrolling?

Typical XML row data

foodata fooid=4997 fooid2=0 fooid3=2909 foot=9 startdate=2010-04-09 
13:45:00 enddate=2010-04-09 14:45:00 foost=1 fooname=New Foobar 
foosub=More Foobardata fooloc=false fooonly=false
/foodata

When all said and done being loaded, vertical scrolling is noticeably slow on a 
new iMac (Safari or Firefox with latest FlashPlayer) compared to a stripped 
down non-XML data provider version which scrolls quickly.

Googling consensus shows that XMLListCollection is not the optimal dataprovider 
in this scenario and that XML in general is not the best choice if it can be 
avoided.


Can anybody shed any light on a better way to improve scrolling performance 
based upon this scenario?


Thanks in advance.




[flexcoders] Re: Wow. Healthcare passed and flashbuilder 4 all in the same day

2010-03-22 Thread jamesfin
got me there

https://store4.adobe.com/cfusion/store/index.cfm?store=OLS-USview=ols_prodcategory=/Applications/FlashBuilderPremiumdistributionMethod=FULLnr=0#view=ols_prodcategory=/Applications/FlashBuilderPremiumstore=OLS-USloc=en_us



--- In flexcoders@yahoogroups.com, djhatrick djhatr...@... wrote:

 Hi, 
 
 Now how much is the upgrade, and how do i buy it? Looks like the upgrade is 
 not available through the on-line adobe store.
 
 Cheers engineers, and qa and the whole loop.





[flexcoders] Re: How to identify which child of tabNavigatoris clicked?

2010-03-17 Thread jamesfin


Here's a complete working example to start with...

?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute 
applicationComplete=TabOnglet()

mx:Script
![CDATA[
import mx.events.IndexChangedEvent;
import mx.containers.TabNavigator;
import mx.containers.Canvas;
import mx.controls.Button;

public function TabOnglet():void
{
this.setStyle(borderStyle , solid);
//this.percentHeight = 100;
this.percentWidth = 100;
this.createTab(new TabNavigator());
//create an listen to the event
this.initEventListener();

}
/**
 *
 * @param tabNavigator
 *
 */ 
 
private var _myTab:TabNavigator;

private function createTab(tabNavigator:TabNavigator) : void
{
_myTab = tabNavigator;
_myTab.percentHeight = 100;
_myTab.percentWidth = 100;

var canvas1: Canvas= new Canvas();
canvas1.percentHeight=100;
canvas1.percentHeight = 100;
canvas1.percentWidth = 100;
canvas1.label = BPMN;

var canvas2: Canvas= new Canvas();
canvas2.percentHeight=100;
canvas2.percentHeight = 100;
canvas2.percentWidth = 100;
canvas2.label = BPEL;
canvas2.id=bpel;

tabNavigator.addChild(canvas2);
tabNavigator.addChild(canvas1);

this.addChild(tabNavigator);

tabNavigator.addEventListener(Event.CHANGE, changed);
}

private function changed(evt:IndexChangedEvent):void{

trace(Tab changed from ( + evt.oldIndex + ) to ( + 
evt.newIndex + ));
}

/**
 * initialise the event
 *
 */   
private function initEventListener() : void
{

trace(this +  cré un écouteur);
   
//trace(_myTab.getTabAt(1) + 
this.getTabAt(1)__r);
//this.addEventListener(MouseEvent.CLICK, interceptClick, true);
//var tab:Button = _myTab.getTabAt(1);
//tab.addEventListener(MouseEvent.CLICK,interceptClick); 
//this.getChildAt(1).addEventListener(MouseEvent.CLICK, 
interceptClick, true);
  
}


]]
/mx:Script

/mx:Application





--- In flexcoders@yahoogroups.com, Nini7016 Nini7016 nahloulaha...@... wrote:

 
 Hello 
 
 
 I would like to know which child of tabNavigator is clicked :
 
 There is my code : 
 
 public function TabOnglet()
 {
 super();
 this.setStyle(borderStyle , solid);
 //this.percentHeight = 100;
 this.percentWidth = 100;
 this.createTab(this);
 //create an listen to the event
 this.initEventListener();
 
 }
 /**
  *
  * @param tabNavigator
  *
  */  
 private function createTab(tabNavigator : TabNavigator) : void
 {
 var canvas1: Canvas= new Canvas();
 canvas1.percentHeight=100;
 canvas1.percentHeight = 100;
 canvas1.percentWidth = 100;
 canvas1.label = BPMN;
 
 var canvas2: Canvas= new Canvas();
 canvas2.percentHeight=100;
 canvas2.percentHeight = 100;
 canvas2.percentWidth = 100;
 canvas2.label = BPEL;
 canvas2.id=bpel;
 
 tabNavigator.addChild(canvas2);
 tabNavigator.addChild(canvas1);
 }
 /**
  * initialise the event
  *
  */
 private function initEventListener() : void
 {
 
 trace(this +  cré un écouteur);
 
 trace(this.getTabAt(1) + 
 this.getTabAt(1)__r);
 //this.addEventListener(MouseEvent.CLICK, interceptClick, true);
 var tab:Button = this.getTabAt(1);
 tab.addEventListener(MouseEvent.CLICK,interceptClick);  
 //this.getChildAt(1).addEventListener(MouseEvent.CLICK, 
 interceptClick, true);

 }
 
 in the browser it displays this message : 'Il est impossible d'accéder à la 
 propriété ou à la méthode d'une référence d'objet nul that is mean it is 
 impossible to acceed to a propriety or method of a reference of object  which 
 is nul .
 
 
 Thanks 
 
 Any idea please ???
 
  
 
 _
 

[flexcoders] Re: How to identify which child of tabNavigatoris clicked?

2010-03-17 Thread jamesfin

The oldIndex is the tab that was current before you click on another tab.  So 
if you have two tabs (like in the demo) with the indices of 0 and 1 and you 
click on the second tab, the oldIndex will be zero (0) and the new tab will be 
one (1).  If you then click on tab 1, oldIndex will be 1 and newIndex will be 0.

The demo app. posted outputs that information in the trace window.



--- In flexcoders@yahoogroups.com, Nini7016 Nini7016 nahloulaha...@... wrote:

 
 it is me again :)
 I don't understand evt.oldIndex 
 how we can identify which child is cliked ???
 
 Because depending the tab clicked i will do action  :(
 
 Thank you very much :) :)
 it is very helpful 
 
 To: flexcoders@yahoogroups.com
 From: james.alan.finni...@...
 Date: Wed, 17 Mar 2010 16:55:14 +
 Subject: [flexcoders] Re: How to identify which child of tabNavigatoris 
 clicked?
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
 
 
   
 
 
 
   
   
   
 
 
 
 Here's a complete working example to start with...
 
 
 
 ?xml version=1.0 encoding=utf-8?
 
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute 
 applicationComplete=TabOnglet()
 
   
 
   mx:Script
 
   ![CDATA[
 
   import mx.events.IndexChangedEvent;
 
   import mx.containers.TabNavigator;
 
   import mx.containers.Canvas;
 
   import mx.controls.Button;
 
   
 
   public function TabOnglet():void
 
 {
 
 this.setStyle(borderStyle , solid);
 
 //this.percentHeight = 100;
 
 this.percentWidth = 100;
 
 this.createTab(new TabNavigator());
 
 //create an listen to the event
 
 this.initEventListener();
 
 
 
 }
 
 /**
 
  *
 
  * @param tabNavigator
 
  *
 
  */ 
 
  
 
 private var _myTab:TabNavigator;
 
 
 
 private function createTab(tabNavigator:TabNavigator) : void
 
 {
 
   _myTab = tabNavigator;
 
   _myTab.percentHeight = 100;
 
   _myTab.percentWidth = 100;
 
   
 
 var canvas1: Canvas= new Canvas();
 
 canvas1.percentHeight=100;
 
 canvas1.percentHeight = 100;
 
 canvas1.percentWidth = 100;
 
 canvas1.label = BPMN;
 
 
 
 var canvas2: Canvas= new Canvas();
 
 canvas2.percentHeight=100;
 
 canvas2.percentHeight = 100;
 
 canvas2.percentWidth = 100;
 
 canvas2.label = BPEL;
 
 canvas2.id=bpel;
 
 
 
 tabNavigator.addChild(canvas2);
 
 tabNavigator.addChild(canvas1);
 
 
 
 this.addChild(tabNavigator);
 
 
 
   tabNavigator.addEventListener(Event.CHANGE, changed);
 
 }
 
 
 
   private function changed(evt:IndexChangedEvent):void{
 
   
 
   trace(Tab changed from ( + evt.oldIndex + ) to ( + 
 evt.newIndex + ));
 
   }
 
 
 
 /**
 
  * initialise the event
 
  *
 
  */   
 
 private function initEventListener() : void
 
 {
 
 
 
 trace(this +  cré un écouteur);
 

 
 //trace(_myTab.getTabAt(1) + 
 this.getTabAt(1)__r);
 
 //this.addEventListener(MouseEvent.CLICK, interceptClick, true);
 
 //var tab:Button = _myTab.getTabAt(1);
 
 //tab.addEventListener(MouseEvent.CLICK,interceptClick); 
 
 //this.getChildAt(1).addEventListener(MouseEvent.CLICK, 
 interceptClick, true);
 
   
 
 }
 
 
 
   
 
   ]]
 
   /mx:Script
 
   
 
 /mx:Application
 
 
 
 --- In flexcoders@yahoogroups.com, Nini7016 Nini7016 nahloulahanem@ wrote:
 
 
 
  
 
  Hello 
 
  
 
  
 
  I would like to know which child of tabNavigator is clicked :
 
  
 
  There is my code : 
 
  
 
  public function TabOnglet()
 
  {
 
  super();
 
  this.setStyle(borderStyle , solid);
 
  //this.percentHeight = 100;
 
  this.percentWidth = 100;
 
  this.createTab(this);
 
  //create an listen to the event
 
  this.initEventListener();
 
  
 
  }
 
  /**
 
   *
 
   * @param tabNavigator
 
   *
 
   */  
 
  private function createTab(tabNavigator : TabNavigator) : void
 
  {
 
  var canvas1: Canvas= new Canvas();
 
  canvas1.percentHeight=100;
 
  canvas1.percentHeight = 100;
 
  canvas1.percentWidth = 100;
 
  canvas1.label = BPMN;
 
  
 
  var canvas2: Canvas= new Canvas();
 
  canvas2.percentHeight=100;
 
  canvas2.percentHeight = 100;
 
  

[flexcoders] Re: Question about currentTarget and Event:Listener

2010-03-04 Thread jamesfin

It would appear as if you never call createHandlers.

Try this version...


?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute 
creationComplete=createHandlers(event)


mx:Script
![CDATA[

import mx.controls.Alert;

public function createHandlers(e:Event):void {
b1.addEventListener(MouseEvent.CLICK, submitForm);
b2.addEventListener(MouseEvent.CLICK, submitForm);
}

private function submitForm(e:Event):void {
// Handle event here.
Alert.show(Current Target:  + e.currentTarget.id);
Alert.show( You clicked me);
}
]]/mx:Script


mx:HBox width=100%
mx:Button id=b1 label=Click Me/
mx:Button id=b2 label=Click Me, Too/
/mx:HBox  


/mx:Application




--- In flexcoders@yahoogroups.com, fred44455 fred44...@... wrote:

 How can I have the button responding when it is clicked with the message : 
 you clicked me 
 I tried but it but it does not work. 
 
 
 
 
  import mx.controls.Alert;
 
 public function createHandlers(e:Event):void {
 b1.addEventListener(MouseEvent.CLICK, submitForm);
 b2.addEventListener(MouseEvent.CLICK, submitForm);
 }
 
 private function submitForm(e:Event):void {
 // Handle event here.
 Alert.show(Current Target:  + e.currentTarget.id);
 Alert.show( You clicked me); 
 }
 ]]/mx:Script
 
 mx:Button id=b1 label=Click Me/
 
 mx:Button id=b2 label=Click Me, Too/
 
 /mx:Application





[flexcoders] Re: Lightweight Flex framework?

2010-03-03 Thread jamesfin
I'd like to know what the definition of a lightweight framework is so we can 
better determine an optimal solution.

Fastest? Most Efficient?, Smallest Code?, Easiest-to-learn?  Easiest on the 
fingers?  Portable?  Proven? 

I had a similar requirement recently for a HTML5/JS project and ended up with 
PureMVC as there is a port for JS and AS3 which pushed me in that direction.  
Sounds like you don't have the same requirement though and will need to wade 
through the Framework guessing game.





--- In flexcoders@yahoogroups.com, Nick Middleweek n...@... wrote:

 Hi,
 
 Here's one to those that have experience with many frameworks...
 
 I'm currently using Cairngorm in a big project but want to start a couple of
 personal projects and want to use a proven framework for good measure.
 
 Is there a lightweight framework that is good for knocking out quick
 prototypes/ personal projects?
 
 Or would you advise not bother and simply use Flex Events, maybe Event
 Broker and a simple model attached to the main application.mxml file?
 
 
 Thanks,
 Nick





[flexcoders] Re: Do you guys consider Flex3/4 be a niche(Market)?

2010-02-28 Thread jamesfin

This is an open-ended question but I'll give it a whirl...

I don't see Flex per se as the linchpin in defining a niche market.  I see it 
as a vehicle to help bring real-world software engineering practices to 
web-based applications.

I've spent over twenty-five years in strict software engineering practices 
organizations primarily using C++ and Java.  Both of these languages have been 
the foundation for large applications (standalone  web-based) for many years 
as they are easily scalable as well as being highly maintainable and they 
offer/promote strong reuseability. 

Flex/AS3 is a nice addendum to both C++ and Java.  It scales nicely and 
promotes / forces you into writing maintainable and reusable code using 
packages and true OOP classes.

Depending on whether or not the so-called rich-client continues to expand, 
Flex/AS3 will always flourish especially when the application becomes tens of 
thousands of lines of code.  I don't see Javascript in its' current form 
(Object-based vs Object-Oriented) a strong foundation in promoting the 
maintainability / reuseability that Flex/AS3 offers in large-scale 
rich-clients.  I have yet to write a javascript based application that is near 
the size/complexity of applications I've written in Flex/AS3.  It gets too 
unwieldy very quickly and un-manageable for large development teams.  For 
example, I have a Flex/AS3 application that is roughly a megabyte (compiled 
using external RSL's) in size and the number of packages/files is enormous as 
is the number of lines of source.  No management team would ever consider 
taking this on in JS.

With all this said, there will always be a demand for good Flex/AS3 developers 
especially in companies that require strong software engineering practices.  

I also think the solutions that are now appearing that convert MXML/AS3 to 
iPhone/Android applications will also keep it alive and well.  

Let the bashing begin...





--- In flexcoders@yahoogroups.com, fred44455 fred44...@... wrote:

 I wonder if you consider Flex being still a niche market or something 
 extremely popular? Also where do you see the demand  trend for Flex 
 developers in the future? Great? Or not so great?





[flexcoders] Re: Vertical separator in MenuBar

2010-02-25 Thread jamesfin
Here's a starting point for you.

To get a leg up on this the next time around you need to do something special 
like this, dive into the base class source code (menubar.as in this case) and 
look around to get a feel for what is happening within the default component.  
For this question, I dove right in and noticed that the updateDisplayList was 
looping through each menu item.  From there I created a new class based upon 
MenuBar and over-rode the updateDisplayList method.  Voila, a quick and easy 
answer.


Also, it would be considerate for all who respond to these type of questions to 
post working code that can be easily pasted into FB as well as describe in 
detail what you did to solve it.  It doesn't help too much when we push off the 
answer and not explain how to solve it the next time.  I spent 10 minutes to 
create the sample and respond which will go a long way for all the other 
developers who will google flex MenuBar vertical line.



MenuBarWithVerticalLine.mxml

?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute 
xmlns:local=*
 local:LocalMenuBar id=myMenuBar labelField=@label
mx:XMLList
menuitem label=MenuItem A
menuitem label=SubMenuItem A-1 enabled=false/
menuitem label=SubMenuItem A-2/
/menuitem
menuitem label=MenuItem B/
menuitem label=MenuItem C/
menuitem label=MenuItem D
menuitem label=SubMenuItem D-1 
type=radio groupName=one/
menuitem label=SubMenuItem D-2 
type=radio groupName=one
selected=true/
menuitem label=SubMenuItem D-3 
type=radio groupName=one/
/menuitem
/mx:XMLList
/local:LocalMenuBar
/mx:Application



LocalMenuBar.as


package{

import mx.controls.MenuBar;
import mx.controls.menuClasses.IMenuBarItemRenderer;

public class LocalMenuBar extends MenuBar{

public function LocalMenuBar(){
super();
}


// we are overriding the updateDisplayList so we can
// get some of the painting action for our vertical bars... 
override protected function 
updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void{

// let the base class draw-up the menu...   
super.updateDisplayList(unscaledWidth, unscaledHeight);

// setup the line style...
graphics.clear();
graphics.lineStyle(1, 0x00, .25);

// time to draw the vertical lines
// skip the first one as we don't
// need a vertical bar before the first menu item

for (var i:int = 1; i  menuBarItems.length; i++){

var item:IMenuBarItemRenderer = menuBarItems[i];

graphics.moveTo(item.x, 2);
graphics.lineTo(item.x, unscaledHeight - 2);
}
}
}
}


--- In flexcoders@yahoogroups.com, Alex Harui aha...@... wrote:

 Use Flex 4 and start with the MenuBar prototype on my blog.
 
 
 On 2/25/10 9:52 AM, creativepragmatic creativepragma...@... wrote:
 
 
 
 
 
 
 Hello Everyone,
 
 My client has requested that a MenuBar be separated by vertical lines in the 
 way that is enabled by default in the LinkBar.  It does not look like this is 
 possible using MenuBar styles.  Does anyone know another way to do it?
 
 Thank you for any guidance,
 
 Orville
 
 
 
 
 
 
 --
 Alex Harui
 Flex SDK Team
 Adobe System, Inc.
 http://blogs.adobe.com/aharui





[flexcoders] Re: Changing the speed of sound?

2010-02-24 Thread jamesfin
Hi Nick,

This will get ugly quickly as this isn't as easy as it sounds, pardon the pun. 
;)

You need to do some pitch-shifting to the audio stream before sending it along 
to play.

Here's a good discussion on it
http://www.dspdimension.com/admin/pitch-shifting-using-the-ft/

Here's a working java sample which you might want to play with before porting 
it over to as3 unless you want to just convert prior to streaming

http://www.mediafire.com/?ze3mymjguim

Let us know what you end up doing as this could be a nice AS3 component.

Thx,
james


--- In flexcoders@yahoogroups.com, Nick Middleweek n...@... wrote:

 Hi,
 
 Is it possible to load in an mp3 and slow the playback down slightly? I've
 looked at the API but can't see anything specific but am wondering if
 there's any tricks?
 
 
 Thanks,
 Nick





[flexcoders] PureMVC Folks...

2010-02-15 Thread jamesfin

For you PureMVC/AS3 Folks...

There's a new PureMVC Port in town...JavaScript.  Well sort of.  There's really 
an update using MooTools which will really move JavaScript along in the 
AS3/PureMVC developers toolbox.

Base Project:
http://trac.puremvc.org/Demo_JS_BoxSplash

Demo:
http://puremvc.org/pages/demos/JS/Demo_JS_BoxSplash/

Source:
http://puremvc.org/pages/demos/JS/Demo_JS_BoxSplash/js/boxsplash.js

If you have ever thought of writing JS, this is a good place to start. 







[flexcoders] The distant cousin AIR...

2010-02-10 Thread jamesfin

My apologies in advance...I realize this is a Flex forum but the Adobe AIR 
forum over at  http://forums.adobe.com/community/labs/air2?view=discussions  
doesn't have the expertise that exists here.  There doesn't seem to be any 
Adobe AIR Engineers monitoring the forum too well either.  Hear that Alex?


I am trying to install AIR 2 Beta 2 on OSX 10.6.2 and get the error below.  
I've tried lots of creative things that you will probably recommend and have 
the same result.  

Before I file a defect with Adobe, anybody have any ideas on how to work around 
this issue?
 
An error occurred while installing Adobe AIR. Installation may not be allowed 
by your administrator. Please contact your administrator.


This is the command line output with not really very helpful error messages...
  
2010-02-08 18:39:42.216 Adobe AIR Installer[15285:903] Performing runtime 
install
2010-02-08 18:39:42.307 Adobe AIR Installer[15285:903] UI SWF load is complete
2010-02-08 18:39:42.511 Adobe AIR Installer[15285:903] UI initialized
2010-02-08 18:39:42.524 Adobe AIR Installer[15285:903] starting user 
confirmation
2010-02-08 18:39:42.527 Adobe AIR Installer[15285:903] Version of this 
installer: 2.0.0.11670
2010-02-08 18:39:42.528 Adobe AIR Installer[15285:903] Installed version: 
1.5.3.9120
2010-02-08 18:39:42.529 Adobe AIR Installer[15285:903] Installation type: 
patchNewer
2010-02-08 18:39:44.688 Adobe AIR Installer[15285:903] starting elevated install
2010-02-08 18:39:45.066 Adobe AIR Installer[15304:e07] performing an elevated 
runtime install
2010-02-08 18:39:45.127 Adobe AIR Installer[15304:e07] UI SWF load is complete
2010-02-08 18:39:45.128 Adobe AIR Installer[15304:e07] starting install
2010-02-08 18:39:45.129 Adobe AIR Installer[15304:e07] Scheduling runtime 
installation operations
2010-02-08 18:39:45.133 Adobe AIR Installer[15304:e07] Beginning runtime 
installation
2010-02-08 18:39:45.162 Adobe AIR Installer[15304:e07] Beginning install
2010-02-08 18:39:45.166 Adobe AIR Installer[15304:e07] Copying 
/Library/Frameworks/Adobe AIR.framework to 
/private/var/folders/zz/zzzivhrRnAmviuee+++/TemporaryItems/FlashTmp0/te 
mp
2010-02-08 18:39:48.113 Adobe AIR Installer[15304:e07] Deleting 
/Library/Frameworks/Adobe AIR.framework
2010-02-08 18:39:48.205 Adobe AIR Installer[15304:e07] Copying 
/Users/jfinnigan/Desktop/AAI.app/Contents/Frameworks/Adobe AIR.framework to 
/Library/Frameworks/Adobe AIR.framework
2010-02-08 18:39:50.097 Adobe AIR Installer[15304:e07] Copying 
/Applications/Utilities/Adobe AIR Uninstaller.app to 
/private/var/folders/zz/zzzivhrRnAmviuee+++/TemporaryItems/FlashTmp1/te 
mp
2010-02-08 18:39:53.142 Adobe AIR Installer[15304:e07] Deleting 
/Applications/Utilities/Adobe AIR Uninstaller.app
2010-02-08 18:39:53.220 Adobe AIR Installer[15304:e07] Copying 
/Users/jfinnigan/Desktop/AAI.app to /Applications/Utilities/Adobe AIR 
Uninstaller.app
2010-02-08 18:39:55.338 Adobe AIR Installer[15304:e07] Copying 
/Applications/Utilities/Adobe AIR Uninstaller.app/Contents/Frameworks/Adobe 
AIR.framework/Versions/Current/Adobe AIR Application Installer.app to 
/private/var/folders/zz/zzzivhrRnAmviuee+++/TemporaryItems/FlashTmp2/te 
mp
2010-02-08 18:39:55.389 Adobe AIR Installer[15304:e07] Deleting 
/Applications/Utilities/Adobe AIR Uninstaller.app/Contents/Frameworks/Adobe 
AIR.framework/Versions/Current/Adobe AIR Application Installer.app
2010-02-08 18:39:55.398 Adobe AIR Installer[15304:e07] Copying 
/Users/jfinnigan/Desktop/AAI.app to /Library/Frameworks/Adobe 
AIR.framework/Versions/Current/Resources/Adobe AIR Updater.app
2010-02-08 18:39:57.529 Adobe AIR Installer[15304:e07] Copying 
/Library/Frameworks/Adobe AIR.framework/Versions/Current/Resources/Adobe AIR 
Updater.app/Contents/Frameworks to 
/private/var/folders/zz/zzzivhrRnAmviuee+++/TemporaryItems/FlashTmp3/te 
mp
2010-02-08 18:39:59.463 Adobe AIR Installer[15304:e07] Deleting 
/Library/Frameworks/Adobe AIR.framework/Versions/Current/Resources/Adobe AIR 
Updater.app/Contents/Frameworks
2010-02-08 18:39:59.550 Adobe AIR Installer[15304:e07] Copying 
/Applications/Utilities/Adobe AIR Application Installer.app to 
/private/var/folders/zz/zzzivhrRnAmviuee+++/TemporaryItems/FlashTmp4/te 
mp
2010-02-08 18:39:59.583 Adobe AIR Installer[15304:e07] Deleting 
/Applications/Utilities/Adobe AIR Application Installer.app
2010-02-08 18:39:59.587 Adobe AIR Installer[15304:e07] Copying 
/Users/jfinnigan/Desktop/AAI.app/Contents/Frameworks/Adobe 
AIR.framework/Versions/Current/Adobe AIR Application Installer.app to 
/Applications/Utilities/Adobe AIR Application Installer.app
2010-02-08 18:39:59.645 Adobe AIR Installer[15304:e07] Registering 
/Applications/Utilities/Adobe AIR Application Installer.app/Contents/Info.plist
2010-02-08 18:39:59.647 Adobe AIR Installer[15304:e07] Copying 
/Applications/Utilities/Adobe AIR Application Installer.app/Contents/Info.plist 
to 

[flexcoders] SubApplications Chapter Trois...

2010-02-02 Thread jamesfin
For any Multi-Versioned SubApplication, what are the hard and fast rules about 
using RSL's?

I tried making the parent (3.4sdk) and child subapplication (3.2sdk) both use 
RSL's but it fails miserably which doesn't surprise me considering the 
complexity of what's going on already.

However, if the parent alone has RSL's enabled, all is well. ;)


So, what are the guidelines.  

i.e. Can never use RSL's on subapplications? 



[flexcoders] Re: SubApplications Chapter Deux...

2010-02-02 Thread jamesfin
():String{
return _someText;
}

public function ResizeEvent(type:String, bubbles:Boolean, 
cancelable:Boolean, someText:String)
{
super(type, bubbles, cancelable);

_someText = someText;
}

}
}






--- In flexcoders@yahoogroups.com, jamesfin james.alan.finni...@... wrote:

 Understood!  I'll add that to my blog.
 
 Thanks again.
 
 --- In flexcoders@yahoogroups.com, Alex Harui aharui@ wrote:
 
  TopLevelSystemManager is might be used by a sub-app of that sub-app to get 
  to its parent sub-app if they are both on the same version and not using 
  loadForCompatibility (did you follow that?)
  
  LoaderContext is available for those who really know what they are doing 
  and need explicit control for some configuration we don't support with the 
  Marshall Plan, usually for controlling the policy file parameter.  The 
  marshall plan does not support re-using an appdom.  LoadForCompatibility 
  refreshes the loaderContext before each load.
  
  
  On 2/1/10 4:01 PM, jamesfin james.alan.finnigan@ wrote:
  
  
  
  
  
  
  And...
  
  With what use-case would the loaderContext be used?
  
  --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , 
  jamesfin james.alan.finnigan@ wrote:
  
   Thanks for the feedback.  Ironically, I had just found the 
   systemManager.getSandboxRoot() reference and was putting it in to test!
  
   While on the same subject, is systemManager.topLevelSystemManager used in 
   a non-sandboxed-sub-app?
  
   I'll blog this for sure as it was quite a hike around the mountain.
  
   Thx again!
  
   --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , 
   Alex Harui aharui@ wrote:
   
Couple of things:
   
   
 1.  You should not be setting a loaderContext.  It doesn't affect this 
test case, but it is not recommended practice.  Set 
loadForCompability=true BEFORE you call load().  I modified your init() 
function to look just like this:
   
private function init():void{
   
loader.loadForCompatibility = true;
loader.load(SubAppTestChild.swf);
}
   
2. I thought the original goal was to get the sub-apps popup to center 
in the main app, but the code looked like the goal was to center 
between two lines.  If the goal is to center in the main app, I 
adjusted the code to look like this:
   
public function loadDialog():void{
var test:TestView = 
PopUpManager.createPopUp(systemManager.getSandboxRoot(), TestView, 
true) as TestView;
PopUpManager.centerPopUp(test);
}
   
   
   
On 2/1/10 11:32 AM, jamesfin james.alan.finnigan@ wrote:
   
   
   
   
   
   
I've been trying to center a dialog in a sub application but haven't 
had any success.  All SubApplication experts can pitch-in here...
   
Backgrounder...SubApps are cool because two SWF's can be compiled with 
different SDK's and can still work together.
   
The upper/left-hand corner of the dialog appears between the two 
HRule's because that is where the SWFLoader resides in the parent MXML. 
 The dialog isn't clipped in any way.
   
I've tried many combinations to get the dialog to center but it won't 
budge.
   
For a quick demo...
   
http://71.36.29.20:/SubAppTestParent.html
   
Parent Source...
   
?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; 
layout=absolute applicationComplete=init() 
preinitialize=preinit()
   
mx:Script
 ![CDATA[
 import mx.controls.SWFLoader;
 import mx.managers.SystemManager;
import mx.events.FlexEvent;
import mx.managers.PopUpManager;
   
 private function preinit():void{
// Security.allowDomain(*);
 }
   
private function init():void{
   
var context:LoaderContext = new LoaderContext();
context.securityDomain = SecurityDomain.currentDomain;
context.applicationDomain = new ApplicationDomain();
loader.loaderContext = context;
loader.load(http://71.36.29.20:/SubAppTestChild.swf;);
loader.loadForCompatibility = true;
loader.trustContent = true;
}
   
private function testChild(event:MouseEvent):void{
(loader.content as Object).application.loadDialog();
 }
   
 ]]
 /mx:Script
   
mx:VBox width=100%
mx:HBox width=100%
mx:Button click=testChild(event) label=Open SubApplication/
mx:Text text=The popup top/left corner should be between the two 
HRule lines/
/mx:HBox
mx:HRule width=100%/
mx:SWFLoader id=loader/
mx:HRule width=100%/
/mx:VBox
   
/mx:Application
   
Child Source...
   
?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http

[flexcoders] Re: SubApplications Chapter Trois...

2010-02-02 Thread jamesfin



Forgot to include the error.  This error only appears if I have framework.swc 
being used via RSL in the child subapplication.


TypeError: Error #1009: Cannot access a property or method of a null object 
reference.
at 
mx.managers::SystemManager/preloader_rslCompleteHandler()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\managers\SystemManager.as:3147]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at 
mx.preloaders::Preloader/http://www.adobe.com/2006/flex/mx/internal::rslCompleteHandler()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\preloaders\Preloader.as:335]
at 
mx.core::RSLListLoader/listCompleteHandler()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\RSLListLoader.as:238]
at 
mx.core::RSLItem/itemCompleteHandler()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\RSLItem.as:233]
at 
mx.core::CrossDomainRSLItem/loadBytesCompleteHandler()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\CrossDomainRSLItem.as:396]




--- In flexcoders@yahoogroups.com, jamesfin james.alan.finni...@... wrote:

 For any Multi-Versioned SubApplication, what are the hard and fast rules 
 about using RSL's?
 
 I tried making the parent (3.4sdk) and child subapplication (3.2sdk) both use 
 RSL's but it fails miserably which doesn't surprise me considering the 
 complexity of what's going on already.
 
 However, if the parent alone has RSL's enabled, all is well. ;)
 
 
 So, what are the guidelines.  
 
 i.e. Can never use RSL's on subapplications?





[flexcoders] Re: SubApplications Chapter Trois...

2010-02-02 Thread jamesfin
I didn't see that small note to move the loadForCompatibility before the load.  
Now that I have done that, I get this error when sending the test event 
message.  However, if I comment out the loadForCompatibility flag, the child 
swf still loads fine (with a different SDK) and everything works.  Not sure I 
understand why the loadForCompatibility is needed UNLESS it is purely for SWF's 
loaded from a different domain then the parent.


TypeError: Error #1034: Type Coercion failed: cannot convert 
resizeev...@2c66aeb1 to ResizeEvent.
at 
SubAppTestParent/newText()[/Users/jfinnigan/Documents/android/SubAppTestParent/src/SubAppTestParent.mxml:36]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at 
TestView/sendParent()[/Users/jfinnigan/Documents/android/SubAppTestChild/src/TestView.mxml:21]
at 
TestView/___TestView_Button1_click()[/Users/jfinnigan/Documents/android/SubAppTestChild/src/TestView.mxml:33]




--- In flexcoders@yahoogroups.com, Alex Harui aha...@... wrote:

 The rules are that each sub-app must load its own RSLs.  I'm still suspicious 
 that you have the load call before setting loadForCompatiblity
 
 
 On 2/2/10 10:41 AM, jamesfin james.alan.finni...@... wrote:
 
 
 
 
 
 
 
 
 Forgot to include the error.  This error only appears if I have framework.swc 
 being used via RSL in the child subapplication.
 
 TypeError: Error #1009: Cannot access a property or method of a null object 
 reference.
 at 
 mx.managers::SystemManager/preloader_rslCompleteHandler()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\managers\SystemManager.as:3147]
 at flash.events::EventDispatcher/dispatchEventFunction()
 at flash.events::EventDispatcher/dispatchEvent()
 at 
 mx.preloaders::Preloader/http://www.adobe.com/2006/flex/mx/internal::rslCompleteHandler()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\preloaders\Preloader.as:335]
 at 
 mx.core::RSLListLoader/listCompleteHandler()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\RSLListLoader.as:238]
 at 
 mx.core::RSLItem/itemCompleteHandler()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\RSLItem.as:233]
 at 
 mx.core::CrossDomainRSLItem/loadBytesCompleteHandler()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\CrossDomainRSLItem.as:396]
 
 --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , 
 jamesfin james.alan.finnigan@ wrote:
 
  For any Multi-Versioned SubApplication, what are the hard and fast rules 
  about using RSL's?
 
  I tried making the parent (3.4sdk) and child subapplication (3.2sdk) both 
  use RSL's but it fails miserably which doesn't surprise me considering the 
  complexity of what's going on already.
 
  However, if the parent alone has RSL's enabled, all is well. ;)
 
 
  So, what are the guidelines.
 
  i.e. Can never use RSL's on subapplications?
 
 
 
 
 
 
 
 --
 Alex Harui
 Flex SDK Team
 Adobe System, Inc.
 http://blogs.adobe.com/aharui





[flexcoders] Re: SubApplications Chapter Trois...

2010-02-02 Thread jamesfin


I've moved the loadForCompatibility and the resizing event is now marshalled.

However, the child sub-app is 3.2sdk and the parent is 3.4sdk and nobody is 
complaining with/without the compatibility flag.  It used to though. ;(

Is there a way to show an Alert from within a SWF to show which SDK it is 
leveraging?  

I've clear the flash cache with 
http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager03.html
 so I know it isn't locally cached.

http://71.36.29.20:/SubAppTestParent.html

Shows the current version with...

loader.trustContent = true;
loader.visible = true;
loader.loadForCompatibility = true;

loader.load(http://71.36.29.20:/SubAppTestChild.swf;);

// this is where resize events will return...

loader.loaderInfo.sharedEvents.addEventListener(ResizeEvent.RESIZE_EVENT, 
newText);






--- In flexcoders@yahoogroups.com, Alex Harui aha...@... wrote:

 You need to set loadForCompatility=true before the load() in order to force 
 the child into its own applicationdomain and therefore isolate it from the 
 version of the SDK in the parent app.  Doing so will then give the parent and 
 child different versions of ResizeEvent as you would want and expect in 
 version isolation otherwise a  change to ResizeEvent could cause a failure in 
 the child app.  The correct technique is to marshal all events going between 
 applicationdomains.
 
 If you don't set loadForCompatibility=true before the load() and the child is 
 truly on a different version of the SDK, you should see verify errors.  If 
 both parent and child are on the same SDK, it will work, but as soon as the 
 parent gets a newer SDK, you will start to see verify errors.
 
 You could also set the source property instead of calling load and then order 
 wouldn't matter.
 
 
 On 2/2/10 12:11 PM, jamesfin james.alan.finni...@... wrote:
 
 
 
 
 
 
 I didn't see that small note to move the loadForCompatibility before the 
 load.  Now that I have done that, I get this error when sending the test 
 event message.  However, if I comment out the loadForCompatibility flag, the 
 child swf still loads fine (with a different SDK) and everything works.  Not 
 sure I understand why the loadForCompatibility is needed UNLESS it is purely 
 for SWF's loaded from a different domain then the parent.
 
 TypeError: Error #1034: Type Coercion failed: cannot convert 
 resizeev...@2c66aeb1 to ResizeEvent.
 at 
 SubAppTestParent/newText()[/Users/jfinnigan/Documents/android/SubAppTestParent/src/SubAppTestParent.mxml:36]
 at flash.events::EventDispatcher/dispatchEventFunction()
 at flash.events::EventDispatcher/dispatchEvent()
 at 
 TestView/sendParent()[/Users/jfinnigan/Documents/android/SubAppTestChild/src/TestView.mxml:21]
 at 
 TestView/___TestView_Button1_click()[/Users/jfinnigan/Documents/android/SubAppTestChild/src/TestView.mxml:33]
 
 --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , 
 Alex Harui aharui@ wrote:
 
  The rules are that each sub-app must load its own RSLs.  I'm still 
  suspicious that you have the load call before setting loadForCompatiblity
 
 
  On 2/2/10 10:41 AM, jamesfin james.alan.finnigan@ wrote:
 
 
 
 
 
 
 
 
  Forgot to include the error.  This error only appears if I have 
  framework.swc being used via RSL in the child subapplication.
 
  TypeError: Error #1009: Cannot access a property or method of a null object 
  reference.
  at 
  mx.managers::SystemManager/preloader_rslCompleteHandler()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\managers\SystemManager.as:3147]
  at flash.events::EventDispatcher/dispatchEventFunction()
  at flash.events::EventDispatcher/dispatchEvent()
  at 
  mx.preloaders::Preloader/http://www.adobe.com/2006/flex/mx/internal::rslCompleteHandler()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\preloaders\Preloader.as:335]
  at 
  mx.core::RSLListLoader/listCompleteHandler()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\RSLListLoader.as:238]
  at 
  mx.core::RSLItem/itemCompleteHandler()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\RSLItem.as:233]
  at 
  mx.core::CrossDomainRSLItem/loadBytesCompleteHandler()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\CrossDomainRSLItem.as:396]
 
  --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com  
  mailto:flexcoders%40yahoogroups.com , jamesfin james.alan.finnigan@ 
  wrote:
  
   For any Multi-Versioned SubApplication, what are the hard and fast rules 
   about using RSL's?
  
   I tried making the parent (3.4sdk) and child subapplication (3.2sdk) both 
   use RSL's but it fails miserably which doesn't surprise me considering 
   the complexity of what's going on already.
  
   However, if the parent alone has RSL's enabled, all is well. ;)
  
  
   So, what are the guidelines.
  
   i.e

[flexcoders] SubApplications Chapter Deux...

2010-02-01 Thread jamesfin
I've been trying to center a dialog in a sub application but haven't had any 
success.  All SubApplication experts can pitch-in here...

Backgrounder...SubApps are cool because two SWF's can be compiled with 
different SDK's and can still work together.  

The upper/left-hand corner of the dialog appears between the two HRule's 
because that is where the SWFLoader resides in the parent MXML.  The dialog 
isn't clipped in any way.

I've tried many combinations to get the dialog to center but it won't budge.

For a quick demo...

http://71.36.29.20:/SubAppTestParent.html




Parent Source...

?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute 
applicationComplete=init() preinitialize=preinit()


  mx:Script
![CDATA[
import mx.controls.SWFLoader;
import mx.managers.SystemManager;
import mx.events.FlexEvent;
import mx.managers.PopUpManager; 

private function preinit():void{
//  Security.allowDomain(*);
}

private function init():void{

var context:LoaderContext = new LoaderContext();
context.securityDomain = SecurityDomain.currentDomain;
context.applicationDomain = new ApplicationDomain();
loader.loaderContext = context;

loader.load(http://71.36.29.20:/SubAppTestChild.swf;);
loader.loadForCompatibility = true;
loader.trustContent = true;
}


private function testChild(event:MouseEvent):void{
(loader.content as Object).application.loadDialog();
}

]]
/mx:Script

mx:VBox width=100%
mx:HBox width=100%
mx:Button click=testChild(event) label=Open SubApplication/   
mx:Text text=The popup top/left corner should be between the two 
HRule lines/
/mx:HBox  
mx:HRule width=100%/
mx:SWFLoader id=loader/
mx:HRule width=100%/
/mx:VBox

/mx:Application





Child Source...


?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute 
preinitialize=preinit() viewSourceURL=srcview/index.html

mx:Script
![CDATA[

import mx.managers.PopUpManager;

private function preinit():void{
//  Security.allowDomain(*);
}

public function loadDialog():void{
var test:TestView = 
PopUpManager.createPopUp(Application.application as DisplayObject, TestView, 
true) as TestView;
PopUpManager.centerPopUp(test); 
}   

]]
/mx:Script
/mx:Application






[flexcoders] Re: SubApplications Chapter Deux...

2010-02-01 Thread jamesfin
Thanks for the feedback.  Ironically, I had just found the 
systemManager.getSandboxRoot() reference and was putting it in to test!

While on the same subject, is systemManager.topLevelSystemManager used in a 
non-sandboxed-sub-app?

I'll blog this for sure as it was quite a hike around the mountain.

Thx again!

--- In flexcoders@yahoogroups.com, Alex Harui aha...@... wrote:

 Couple of things:
 
 
  1.  You should not be setting a loaderContext.  It doesn't affect this test 
 case, but it is not recommended practice.  Set loadForCompability=true BEFORE 
 you call load().  I modified your init() function to look just like this:
 
 private function init():void{
 
 loader.loadForCompatibility = true;
 loader.load(SubAppTestChild.swf);
 }
 
 2. I thought the original goal was to get the sub-apps popup to center in the 
 main app, but the code looked like the goal was to center between two lines.  
 If the goal is to center in the main app, I adjusted the code to look like 
 this:
 
 public function loadDialog():void{
 var test:TestView = 
 PopUpManager.createPopUp(systemManager.getSandboxRoot(), TestView, true) as 
 TestView;
 PopUpManager.centerPopUp(test);
 }
 
 
 
 On 2/1/10 11:32 AM, jamesfin james.alan.finni...@... wrote:
 
 
 
 
 
 
 I've been trying to center a dialog in a sub application but haven't had any 
 success.  All SubApplication experts can pitch-in here...
 
 Backgrounder...SubApps are cool because two SWF's can be compiled with 
 different SDK's and can still work together.
 
 The upper/left-hand corner of the dialog appears between the two HRule's 
 because that is where the SWFLoader resides in the parent MXML.  The dialog 
 isn't clipped in any way.
 
 I've tried many combinations to get the dialog to center but it won't budge.
 
 For a quick demo...
 
 http://71.36.29.20:/SubAppTestParent.html
 
 Parent Source...
 
 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute 
 applicationComplete=init() preinitialize=preinit()
 
 mx:Script
  ![CDATA[
  import mx.controls.SWFLoader;
  import mx.managers.SystemManager;
 import mx.events.FlexEvent;
 import mx.managers.PopUpManager;
 
  private function preinit():void{
 // Security.allowDomain(*);
  }
 
 private function init():void{
 
 var context:LoaderContext = new LoaderContext();
 context.securityDomain = SecurityDomain.currentDomain;
 context.applicationDomain = new ApplicationDomain();
 loader.loaderContext = context;
 loader.load(http://71.36.29.20:/SubAppTestChild.swf;);
 loader.loadForCompatibility = true;
 loader.trustContent = true;
 }
 
 private function testChild(event:MouseEvent):void{
 (loader.content as Object).application.loadDialog();
  }
 
  ]]
  /mx:Script
 
 mx:VBox width=100%
 mx:HBox width=100%
 mx:Button click=testChild(event) label=Open SubApplication/
 mx:Text text=The popup top/left corner should be between the two HRule 
 lines/
 /mx:HBox
 mx:HRule width=100%/
 mx:SWFLoader id=loader/
 mx:HRule width=100%/
 /mx:VBox
 
 /mx:Application
 
 Child Source...
 
 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute 
 preinitialize=preinit() viewSourceURL=srcview/index.html
 
 mx:Script
 ![CDATA[
 
 import mx.managers.PopUpManager;
 
 private function preinit():void{
 // Security.allowDomain(*);
  }
 
 public function loadDialog():void{
 var test:TestView = PopUpManager.createPopUp(Application.application as 
 DisplayObject, TestView, true) as TestView;
  PopUpManager.centerPopUp(test);
 }
 
 ]]
 /mx:Script
 /mx:Application
 
 
 
 
 
 
 --
 Alex Harui
 Flex SDK Team
 Adobe System, Inc.
 http://blogs.adobe.com/aharui





[flexcoders] Re: SubApplications Chapter Deux...

2010-02-01 Thread jamesfin
And...

With what use-case would the loaderContext be used?





--- In flexcoders@yahoogroups.com, jamesfin james.alan.finni...@... wrote:

 Thanks for the feedback.  Ironically, I had just found the 
 systemManager.getSandboxRoot() reference and was putting it in to test!
 
 While on the same subject, is systemManager.topLevelSystemManager used in a 
 non-sandboxed-sub-app?
 
 I'll blog this for sure as it was quite a hike around the mountain.
 
 Thx again!
 
 --- In flexcoders@yahoogroups.com, Alex Harui aharui@ wrote:
 
  Couple of things:
  
  
   1.  You should not be setting a loaderContext.  It doesn't affect this 
  test case, but it is not recommended practice.  Set loadForCompability=true 
  BEFORE you call load().  I modified your init() function to look just like 
  this:
  
  private function init():void{
  
  loader.loadForCompatibility = true;
  loader.load(SubAppTestChild.swf);
  }
  
  2. I thought the original goal was to get the sub-apps popup to center in 
  the main app, but the code looked like the goal was to center between two 
  lines.  If the goal is to center in the main app, I adjusted the code to 
  look like this:
  
  public function loadDialog():void{
  var test:TestView = 
  PopUpManager.createPopUp(systemManager.getSandboxRoot(), TestView, true) as 
  TestView;
  PopUpManager.centerPopUp(test);
  }
  
  
  
  On 2/1/10 11:32 AM, jamesfin james.alan.finnigan@ wrote:
  
  
  
  
  
  
  I've been trying to center a dialog in a sub application but haven't had 
  any success.  All SubApplication experts can pitch-in here...
  
  Backgrounder...SubApps are cool because two SWF's can be compiled with 
  different SDK's and can still work together.
  
  The upper/left-hand corner of the dialog appears between the two HRule's 
  because that is where the SWFLoader resides in the parent MXML.  The dialog 
  isn't clipped in any way.
  
  I've tried many combinations to get the dialog to center but it won't budge.
  
  For a quick demo...
  
  http://71.36.29.20:/SubAppTestParent.html
  
  Parent Source...
  
  ?xml version=1.0 encoding=utf-8?
  mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute 
  applicationComplete=init() preinitialize=preinit()
  
  mx:Script
   ![CDATA[
   import mx.controls.SWFLoader;
   import mx.managers.SystemManager;
  import mx.events.FlexEvent;
  import mx.managers.PopUpManager;
  
   private function preinit():void{
  // Security.allowDomain(*);
   }
  
  private function init():void{
  
  var context:LoaderContext = new LoaderContext();
  context.securityDomain = SecurityDomain.currentDomain;
  context.applicationDomain = new ApplicationDomain();
  loader.loaderContext = context;
  loader.load(http://71.36.29.20:/SubAppTestChild.swf;);
  loader.loadForCompatibility = true;
  loader.trustContent = true;
  }
  
  private function testChild(event:MouseEvent):void{
  (loader.content as Object).application.loadDialog();
   }
  
   ]]
   /mx:Script
  
  mx:VBox width=100%
  mx:HBox width=100%
  mx:Button click=testChild(event) label=Open SubApplication/
  mx:Text text=The popup top/left corner should be between the two HRule 
  lines/
  /mx:HBox
  mx:HRule width=100%/
  mx:SWFLoader id=loader/
  mx:HRule width=100%/
  /mx:VBox
  
  /mx:Application
  
  Child Source...
  
  ?xml version=1.0 encoding=utf-8?
  mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute 
  preinitialize=preinit() viewSourceURL=srcview/index.html
  
  mx:Script
  ![CDATA[
  
  import mx.managers.PopUpManager;
  
  private function preinit():void{
  // Security.allowDomain(*);
   }
  
  public function loadDialog():void{
  var test:TestView = PopUpManager.createPopUp(Application.application as 
  DisplayObject, TestView, true) as TestView;
   PopUpManager.centerPopUp(test);
  }
  
  ]]
  /mx:Script
  /mx:Application
  
  
  
  
  
  
  --
  Alex Harui
  Flex SDK Team
  Adobe System, Inc.
  http://blogs.adobe.com/aharui
 





[flexcoders] Re: SubApplications Chapter Deux...

2010-02-01 Thread jamesfin
Understood!  I'll add that to my blog.

Thanks again.

--- In flexcoders@yahoogroups.com, Alex Harui aha...@... wrote:

 TopLevelSystemManager is might be used by a sub-app of that sub-app to get to 
 its parent sub-app if they are both on the same version and not using 
 loadForCompatibility (did you follow that?)
 
 LoaderContext is available for those who really know what they are doing and 
 need explicit control for some configuration we don't support with the 
 Marshall Plan, usually for controlling the policy file parameter.  The 
 marshall plan does not support re-using an appdom.  LoadForCompatibility 
 refreshes the loaderContext before each load.
 
 
 On 2/1/10 4:01 PM, jamesfin james.alan.finni...@... wrote:
 
 
 
 
 
 
 And...
 
 With what use-case would the loaderContext be used?
 
 --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , 
 jamesfin james.alan.finnigan@ wrote:
 
  Thanks for the feedback.  Ironically, I had just found the 
  systemManager.getSandboxRoot() reference and was putting it in to test!
 
  While on the same subject, is systemManager.topLevelSystemManager used in a 
  non-sandboxed-sub-app?
 
  I'll blog this for sure as it was quite a hike around the mountain.
 
  Thx again!
 
  --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , 
  Alex Harui aharui@ wrote:
  
   Couple of things:
  
  
1.  You should not be setting a loaderContext.  It doesn't affect this 
   test case, but it is not recommended practice.  Set 
   loadForCompability=true BEFORE you call load().  I modified your init() 
   function to look just like this:
  
   private function init():void{
  
   loader.loadForCompatibility = true;
   loader.load(SubAppTestChild.swf);
   }
  
   2. I thought the original goal was to get the sub-apps popup to center in 
   the main app, but the code looked like the goal was to center between two 
   lines.  If the goal is to center in the main app, I adjusted the code to 
   look like this:
  
   public function loadDialog():void{
   var test:TestView = 
   PopUpManager.createPopUp(systemManager.getSandboxRoot(), TestView, true) 
   as TestView;
   PopUpManager.centerPopUp(test);
   }
  
  
  
   On 2/1/10 11:32 AM, jamesfin james.alan.finnigan@ wrote:
  
  
  
  
  
  
   I've been trying to center a dialog in a sub application but haven't had 
   any success.  All SubApplication experts can pitch-in here...
  
   Backgrounder...SubApps are cool because two SWF's can be compiled with 
   different SDK's and can still work together.
  
   The upper/left-hand corner of the dialog appears between the two HRule's 
   because that is where the SWFLoader resides in the parent MXML.  The 
   dialog isn't clipped in any way.
  
   I've tried many combinations to get the dialog to center but it won't 
   budge.
  
   For a quick demo...
  
   http://71.36.29.20:/SubAppTestParent.html
  
   Parent Source...
  
   ?xml version=1.0 encoding=utf-8?
   mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; 
   layout=absolute applicationComplete=init() preinitialize=preinit()
  
   mx:Script
![CDATA[
import mx.controls.SWFLoader;
import mx.managers.SystemManager;
   import mx.events.FlexEvent;
   import mx.managers.PopUpManager;
  
private function preinit():void{
   // Security.allowDomain(*);
}
  
   private function init():void{
  
   var context:LoaderContext = new LoaderContext();
   context.securityDomain = SecurityDomain.currentDomain;
   context.applicationDomain = new ApplicationDomain();
   loader.loaderContext = context;
   loader.load(http://71.36.29.20:/SubAppTestChild.swf;);
   loader.loadForCompatibility = true;
   loader.trustContent = true;
   }
  
   private function testChild(event:MouseEvent):void{
   (loader.content as Object).application.loadDialog();
}
  
]]
/mx:Script
  
   mx:VBox width=100%
   mx:HBox width=100%
   mx:Button click=testChild(event) label=Open SubApplication/
   mx:Text text=The popup top/left corner should be between the two HRule 
   lines/
   /mx:HBox
   mx:HRule width=100%/
   mx:SWFLoader id=loader/
   mx:HRule width=100%/
   /mx:VBox
  
   /mx:Application
  
   Child Source...
  
   ?xml version=1.0 encoding=utf-8?
   mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; 
   layout=absolute preinitialize=preinit() 
   viewSourceURL=srcview/index.html
  
   mx:Script
   ![CDATA[
  
   import mx.managers.PopUpManager;
  
   private function preinit():void{
   // Security.allowDomain(*);
}
  
   public function loadDialog():void{
   var test:TestView = PopUpManager.createPopUp(Application.application as 
   DisplayObject, TestView, true) as TestView;
PopUpManager.centerPopUp(test);
   }
  
   ]]
   /mx:Script
   /mx:Application
  
  
  
  
  
  
   --
   Alex Harui
   Flex SDK Team
   Adobe System, Inc.
   http://blogs.adobe.com

[flexcoders] Re: Popups in Sub Applications...

2010-01-30 Thread jamesfin


This is my loader code which is built with sdk3.4.  The foo.swf is built with 
3.2 thus the loadForCompatibility=true.  No problems loading it.

loader = new SWFLoader();
addChild(loader);
var context:LoaderContext = new LoaderContext();
context.securityDomain = SecurityDomain.currentDomain;
context.applicationDomain = new ApplicationDomain();
loader.loaderContext = context;
loader.load(http://myhost.com/foo.swf;);
loader.loadForCompatibility = true;
loader.trustContent = true;

If trustContent is true or false, it doesn't change anything in that you can 
see 100% of the dialog (it isn't clipped).


So, show me some code that can center this dialog in this use-case.  If the 
dialog can be shown it can certainly be somehow centered.




--- In flexcoders@yahoogroups.com, Alex Harui aha...@... wrote:

 If the sub-app is in a separate sandbox it gets centered to its sandbox as it 
 is clipped to that area.
 
 
 On 1/29/10 7:42 PM, jamesfin james.alan.finni...@... wrote:
 
 
 
 
 
 
 In addition...
 
 Depending on where the loader is in the display list, the popup seems to move 
 around relative to it.
 
 // AS3
 loader = new SWFLoader();
 addChild(loader);
 
 // MXML
 mx:SWFLoader id=loader/
 
 --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , 
 jamesfin james.alan.finnigan@ wrote:
 
  I've been studying the sub application functionality lately and have a 
  question.
 
  If a multi-versioned sub application wants to put up a popup via the popup 
  manager, it all works well except that the centerPopUp doesn't seem to work 
  correctly in that it isn't centered in the Main application.  This is 
  probably due to that the loadForCompatibility is true and the docs note the 
  following:
 
  There are several ways to access the methods and properties of the main 
  application from the sub-application. These ways only work for 
  sub-applications that are loaded as children into a main application's 
  application domain. You cannot use these for sandboxed applications, or for 
  multi-versioned applications.
 
  These methods include:
 
Using the application property of the Application class. This 
  property accesses the root application from anywhere in the application. 
  For more information, see Accessing document and application scopes.
 
Using the parentDocument property of the Application class. This is 
  useful if you have multiple applications embedded and want to just access 
  the immediate parent. For more information, see Accessing document and 
  application scopes.
 
 
 
  So, I'll take PopUps in a multiversion sub application for $100...
 
 
 
  What do I pass for the createPopUp first parameter to get it to center on 
  the main application hosting the sub application?  Or, can the main 
  application/parent move the window after it appears perhaps? Or, better 
  yet, the best solution?
 
 
  public static function createPopUp(parent:DisplayObject...
 
 
 
 
 
 
 
 --
 Alex Harui
 Flex SDK Team
 Adobe System, Inc.
 http://blogs.adobe.com/aharui





[flexcoders] Re: Popups in Sub Applications...

2010-01-30 Thread jamesfin
Thanks for the tips.  The caveat here is that Application.application means 
nothing to a multi-versioned subapplication.  I've tried passing that in to the 
sub application as well as tried Application.application in the sub application 
itself with no luck.

Any other takers with working code examples?



--- In flexcoders@yahoogroups.com, myflexdownloads myflexdownlo...@... 
wrote:

 I normally just create the popup as a child of Application.application and 
 that way cenetering is perfect.
 
 Web Admin
 FlexDownloads.com
 
 --- In flexcoders@yahoogroups.com, jamesfin james.alan.finnigan@ wrote:
 
  I've been studying the sub application functionality lately and have a 
  question.
  
  If a multi-versioned sub application wants to put up a popup via the popup 
  manager, it all works well except that the centerPopUp doesn't seem to work 
  correctly in that it isn't centered in the Main application.  This is 
  probably due to that the loadForCompatibility is true and the docs note the 
  following:
  
  There are several ways to access the methods and properties of the main 
  application from the sub-application. These ways only work for 
  sub-applications that are loaded as children into a main application's 
  application domain. You cannot use these for sandboxed applications, or for 
  multi-versioned applications.
  
  These methods include:
  
Using the application property of the Application class. This 
  property accesses the root application from anywhere in the application. 
  For more information, see Accessing document and application scopes.
  
Using the parentDocument property of the Application class. This is 
  useful if you have multiple applications embedded and want to just access 
  the immediate parent. For more information, see Accessing document and 
  application scopes.
  
  
  
  So, I'll take PopUps in a multiversion sub application for $100...
  
  
  
  What do I pass for the createPopUp first parameter to get it to center on 
  the main application hosting the sub application?  Or, can the main 
  application/parent move the window after it appears perhaps? Or, better 
  yet, the best solution?
  
  
  public static function createPopUp(parent:DisplayObject...
 





[flexcoders] Re: Popups in Sub Applications...

2010-01-30 Thread jamesfin
Tweak: Application.application of the main application means nothing to the 
subapplication.

--- In flexcoders@yahoogroups.com, jamesfin james.alan.finni...@... wrote:

 Thanks for the tips.  The caveat here is that Application.application means 
 nothing to a multi-versioned subapplication.  I've tried passing that in to 
 the sub application as well as tried Application.application in the sub 
 application itself with no luck.
 
 Any other takers with working code examples?
 
 
 
 --- In flexcoders@yahoogroups.com, myflexdownloads myflexdownloads@ wrote:
 
  I normally just create the popup as a child of Application.application and 
  that way cenetering is perfect.
  
  Web Admin
  FlexDownloads.com
  
  --- In flexcoders@yahoogroups.com, jamesfin james.alan.finnigan@ wrote:
  
   I've been studying the sub application functionality lately and have a 
   question.
   
   If a multi-versioned sub application wants to put up a popup via the 
   popup manager, it all works well except that the centerPopUp doesn't seem 
   to work correctly in that it isn't centered in the Main application.  
   This is probably due to that the loadForCompatibility is true and the 
   docs note the following:
   
   There are several ways to access the methods and properties of the main 
   application from the sub-application. These ways only work for 
   sub-applications that are loaded as children into a main application's 
   application domain. You cannot use these for sandboxed applications, or 
   for multi-versioned applications.
   
   These methods include:
   
 Using the application property of the Application class. This 
   property accesses the root application from anywhere in the application. 
   For more information, see Accessing document and application scopes.
   
 Using the parentDocument property of the Application class. This is 
   useful if you have multiple applications embedded and want to just access 
   the immediate parent. For more information, see Accessing document and 
   application scopes.
   
   
   
   So, I'll take PopUps in a multiversion sub application for $100...
   
   
   
   What do I pass for the createPopUp first parameter to get it to center on 
   the main application hosting the sub application?  Or, can the main 
   application/parent move the window after it appears perhaps? Or, better 
   yet, the best solution?
   
   
   public static function createPopUp(parent:DisplayObject...
  
 





[flexcoders] Popups in Sub Applications...

2010-01-29 Thread jamesfin
I've been studying the sub application functionality lately and have a question.

If a multi-versioned sub application wants to put up a popup via the popup 
manager, it all works well except that the centerPopUp doesn't seem to work 
correctly in that it isn't centered in the Main application.  This is probably 
due to that the loadForCompatibility is true and the docs note the following:

There are several ways to access the methods and properties of the main 
application from the sub-application. These ways only work for sub-applications 
that are loaded as children into a main application's application domain. You 
cannot use these for sandboxed applications, or for multi-versioned 
applications.

These methods include:

  Using the application property of the Application class. This property 
accesses the root application from anywhere in the application. For more 
information, see Accessing document and application scopes.

  Using the parentDocument property of the Application class. This is 
useful if you have multiple applications embedded and want to just access the 
immediate parent. For more information, see Accessing document and application 
scopes.



So, I'll take PopUps in a multiversion sub application for $100...



What do I pass for the createPopUp first parameter to get it to center on the 
main application hosting the sub application?  Or, can the main 
application/parent move the window after it appears perhaps? Or, better yet, 
the best solution?


public static function createPopUp(parent:DisplayObject...


 



[flexcoders] Re: Popups in Sub Applications...

2010-01-29 Thread jamesfin
In addition...

Depending on where the loader is in the display list, the popup seems to move 
around relative to it.

// AS3
loader = new SWFLoader();
addChild(loader);

// MXML
mx:SWFLoader id=loader/  



--- In flexcoders@yahoogroups.com, jamesfin james.alan.finni...@... wrote:

 I've been studying the sub application functionality lately and have a 
 question.
 
 If a multi-versioned sub application wants to put up a popup via the popup 
 manager, it all works well except that the centerPopUp doesn't seem to work 
 correctly in that it isn't centered in the Main application.  This is 
 probably due to that the loadForCompatibility is true and the docs note the 
 following:
 
 There are several ways to access the methods and properties of the main 
 application from the sub-application. These ways only work for 
 sub-applications that are loaded as children into a main application's 
 application domain. You cannot use these for sandboxed applications, or for 
 multi-versioned applications.
 
 These methods include:
 
   Using the application property of the Application class. This property 
 accesses the root application from anywhere in the application. For more 
 information, see Accessing document and application scopes.
 
   Using the parentDocument property of the Application class. This is 
 useful if you have multiple applications embedded and want to just access the 
 immediate parent. For more information, see Accessing document and 
 application scopes.
 
 
 
 So, I'll take PopUps in a multiversion sub application for $100...
 
 
 
 What do I pass for the createPopUp first parameter to get it to center on the 
 main application hosting the sub application?  Or, can the main 
 application/parent move the window after it appears perhaps? Or, better yet, 
 the best solution?
 
 
 public static function createPopUp(parent:DisplayObject...





[flexcoders] Re: Pointers

2010-01-29 Thread jamesfin


Here's what I've done in the past...

// add this in your init code...
myDataGrid.addEventListener(ListEvent.ITEM_EDIT_END, editEnd);



private function editEnd(evt:DataGridEvent):void{

// get a reference to the datagrid
var grid:DataGrid = evt.target as DataGrid;

// get a reference to the name of the property in the
// underlying object corresponding to the cell that's being edited
var field:String = evt.dataField;

// get a reference to the row number (the index in the 
// dataprovider of the row that's being edited)
var row:Number = Number(evt.rowIndex);

// get a reference to the column number of
// the cell that's being edited
var col:int = evt.columnIndex;


if (grid != null){

var oldValue:String = String(grid.dataProvider.getItemAt(row)[field]);

var newValue:String = 
String(grid.itemEditorInstance[grid.columns[col].editorDataField]);

var rowData:XML = XML(grid.dataProvider.getItemAt(row)[0]);
  
// check if the value has changed
if (newValue == oldValue){
// nothing has changed...
return;
}


// something has changed...
// do something...
// you could prevent the change if you want
// or do some validation
// or just return and the data move on to the dp.
}

}


--- In flexcoders@yahoogroups.com, Dan Pride danielpr...@... wrote:

 Looking for suggestions on how to approach an issue.
 
 I want to write a function to compare the current value of a text field with 
 the value of the field in the selected row of the dataGrid. I want to use the 
 function as a focus-out handler on every text input.
 
 Obviously I don't want to rewrite this for each and every field but I did not 
 see a functional similarity to a pointer in actionscript or did I just miss 
 it?
 
 This is for the awesome Flashbuilder 4,... I have a text input for every 
 field in the value object and want to compare each to the selectedItem for 
 the dataGrid and kick some stuff if it does not match.
 Thanks
 Dan Pride





[flexcoders] Re: Preferred Socket Policy File Server Implementation?

2010-01-22 Thread jamesfin



Here's a Java based PFS...a flash-player bug seems to still exist though...
https://bugs.adobe.com/jira/browse/FP-1866


package

import java.io.BufferedReader;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.InterruptedIOException;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * Class PolicyServer
 * Starts a PolicyServer on the specified port.
 * Can be started as main class, passing the port number as the first command 
line argument
 *
 */

public class PolicyServer extends Thread
{
/**
 * If no argument is passed the server will listen on this port for 
connections
 */
public static final int DEFAULT_PORT = 1008;
public static final String[] DEFAULT_POLICY = new String[] { * };

/**
 * The character sequence sent by the Flash Player to request a _policy 
file
 */
public static final String POLICY_REQUEST = policy-file-request/;

public static final boolean DEBUG = true;

/**
 * @param args  Use the first command line argument to set the port the 
server will listen on for connections
 */
public static void main(String[] args)
{
int port = DEFAULT_PORT;
try
{
if (args.length0) port = Integer.parseInt(args[0]);
}
catch (NumberFormatException e) {}

// Start the PolicyServer
(new PolicyServer( port , new String[] { *:80 })).start();
}


/*
 * PolicyServer class variables
 */
private int _port;
private boolean _listening;
private ServerSocket _socketServer;
private String _policy;


/**
 * PolicyServer constructor
 * @param port_ Sets the port that the PolicyServer listens on
 */
public PolicyServer( int port_, String[] allowedHosts_ )
{
_port = port_;
_listening=true;
if (allowedHosts_==null) allowedHosts_ = DEFAULT_POLICY;
_policy = buildPolicy(allowedHosts_);
}

private String buildPolicy( String[] allowedHosts_ )
{
StringBuffer policyBuffer = new StringBuffer();

policyBuffer.append(?xml 
version=\1.0\?cross-domain-policy);
for (int i = 0; i  allowedHosts_.length; i++) {
String[] hostInfo = allowedHosts_[i].split(:);
String hostname = hostInfo[0];
String ports;
if (hostInfo.length1) ports = hostInfo[1];
else ports = *;

policyBuffer.append(allow-access-from 
domain=\+hostname+\ to-ports=\+ports+\ /);
}
policyBuffer.append(/cross-domain-policy);

return policyBuffer.toString();
}

/**
 * Thread run method, accepts incoming connections and creates 
SocketConnection objects to handle requests
 */
public void run()
{
try
{
_listening=true;

// Start listening for connections
_socketServer = new ServerSocket(_port,50);
if (DEBUG) System.out.println(PolicyServer listening 
on port +_port);

while(_listening)
{
// Wait for a connection and accept it
Socket socket = _socketServer.accept();

try
{
if (DEBUG) 
System.out.println(PolicyServer got a connection on port +_port);
// Start a new connection thread
(new SocketConnection(socket)).start();
}
catch (Exception e)
{
if (DEBUG) 
System.out.println(Exception: +e.getMessage());
}
try
{
// Wait for a sec until a new 
connection is accepted to avoid flooding
sleep(1000);
}
catch (InterruptedException e) {}
}
}
catch(IOException e)
{
if (DEBUG) System.out.println(IO Exception: 

[flexcoders] Re: Setting variables

2010-01-12 Thread jamesfin






Unfortunately, the Inspectable metatag only works for mxml.  Here's a more 
reuseable solution so you can use the same strings when coding in AS3 too.  It 
also will do compile time checking on your selection in either case.

MAIN APPLICATION...

?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; 
creationComplete=init() xmlns:trans=*

mx:Script
![CDATA[

private function init():void{

var tr:tranny = new tranny();
tr.gear = tranny.FIRST; 
}
]]
/mx:Script

trans:tranny gear={tranny.FIRST}/

/mx:Application



TRANNY COMPONENT/CLASS

package
{
public class tranny{

private var _gear:String;

public function tranny(){
super();
}

// these const's must match the Inspectable enumeration
public static const FIRST:String = first;
public static const SECOND:String = second;
public static const THIRD:String = third;

[Inspectable(category=Tranny, 
enumeration={tranny.FIRST},{tranny.SECOND},{tranny.THIRD})]
public function set gear(gr:String):void{
_gear = gr; 
}

public function get gear():String{
return _gear;
}
}
}





--- In flexcoders@yahoogroups.com, turbo_vb timh...@... wrote:

 On the line above your setter, use the Inspectable metadata:
 
 [Inspectable(category=General, enumeration=auto,up,down, 
 defaultValue=auto)]
 
 -TH
 
 --- In flexcoders@yahoogroups.com, Warren warrenonyaho@ wrote:
 
  I'm creating my own actionscript class which will have a public property 
  accessed via a getter and setter.  I want this property to have one of thew 
  values: up. down. auto.  How do I set things up so that when I use the 
  class in Flexbuilder, only these choices appear as property selections?
  
  I'm in Flex 3.2.0
  
  Thanks!
  
  Warren Koch
 





[flexcoders] Flex Printing...

2010-01-06 Thread jamesfin
I've spent two days researching and playing with printing in Flex 3.4.  I was 
somewhat excited to learn this area of Flex which I had not previously explored 
but have only one word (for now): Disappointing.

Primarily because there are many, many unresolved defects with various parts of 
the printing system that render it unusable.  There are a couple of 
alternatives but they are unprofessional at best.  The PrintDataGrid works 
awesome if you have simple no-wrap/no-renderer rows and no more than one page 
and forget multi-page printing, it's a mess.

Dear Adobe Flex Engineer Folk,

Can anybody with authority speak openly and honestly why very little effort has 
been devoted to delivering something that will work out of the box?  I haven't 
run across any other portion of the Flex SDK that is as unusable and you should 
be commended for that effort.  It might be useful to remove all printing 
related documentation until it is all verified and working so others don't 
waste time trying to get it to work.

Based upon the Bug System, very little/if any has improved for the V4 release 
and fixing printing defects remains low on the defect review team list.

Perhaps you can help us outsiders understand the overall Print Strategy for 
Flex?

Sincerely,
Flex Developers Without Printing Folk

p.s.  If you need help, let's assemble a Tiger Team to get it working. ;)






[flexcoders] Re: Stop ToolTips from Appearing on Certain Buttons.

2010-01-05 Thread jamesfin
close...use this

myButton.toolTip = null;



--- In flexcoders@yahoogroups.com, taude1 tpreka...@... wrote:

 That doesn't work, it then creates the tooltip from the label value.
 
 --- In flexcoders@yahoogroups.com, Ariel J arieljake@ wrote:
 
  i believe you can do this by setting the tooltip text to the empty string
  
  --- In flexcoders@yahoogroups.com, taude1 tprekaski@ wrote:
  
   This seems like it should be easy. I know I can turn tooltips off with 
   the ToolTipManager, but that's applciation wide.  I want to disable 
   tooltips from certain Buttons.
   
   I've implemented various combinations of tooltipShow, tooltipStart, 
   tooltipCreate on teh Button and tried setting the toolTips to NULL, to 
   creating a dummy toolTip, etc...
   
   
   Any ideas on how to totally supress tooltips?
   
   Thanks,
  
 





[flexcoders] Re: rewriting a function using prototype?

2009-12-28 Thread jamesfin


I've used this in this pasta bit more verbose but does the trick.

?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute 
creationComplete=createJunk()


mx:Script
![CDATA[

  import mx.controls.Alert;

  public static function createJunk():void {

  var j:junk1 = new junk1();

  // style 1 outputs base f1
  j.f1();
  
  // style 2 outputs base f1
  j[f1]();

  // ooops, have a bug in base f1, reassign it!
  j.dF1 = function():void{trace(junk1 f1 override);}; 


  // override f1 outputs junk1 f1 override
  j[f1]();
  }

  
]]
/mx:Script

/mx:Application



 package {
 
public class junk1 {
import mx.controls.Alert;

public var dF1:Function = realf1;

public function f1():void { 
dF1();
}

private function realf1():void{
trace(base f1);
}
}
 }





--- In flexcoders@yahoogroups.com, mitchgrrt mitch_g...@... wrote:

 In the generated classes there's a hierarchy.  The one with the function I 
 want to override is a base class of another class.  If I extend and override, 
 the other classes in the hierarchy won't get my fix.
 
 --- In flexcoders@yahoogroups.com, Paul Andrews paul@ wrote:
 
  How about extending the Ant generated classes and overriding the function?
  
  Paul





[flexcoders] Re: Using URLLoader with AsyncToken

2009-12-26 Thread jamesfin

This is another starting point

http://anirudhs.chaosnet.org/blog/2008.06.20.html






--- In flexcoders@yahoogroups.com, Karthik Kailash kart...@... wrote:

 Hi all,
 
 I was trying to retrieve binary data over HTTP for my Flex application, and
 was running into some stumbling blocks. HTTPService did not seem to deal
 with binary data well, people said to use URLLoader. But URLLoader does not
 have the nice AsyncToken/IResponder interface that HTTPService provides.
 
 So, I did some searching and could not find anyone extending URLLoader to
 provide this kind of functionality. I went ahead and took a stab at it
 myself:  http://pastebin.com/d7369d0e0 http://pastebin.com/d7369d0e0
 
 Basically it wraps a URLLoader and an AsyncToken, and maps the COMPLETE,
 IO_ERROR, and SECURITY_ERROR events from URLLoader to results/faults that
 get raised on the AsyncToken.
 
 Basic usage:
 
 var tidbitLoader:AsyncURLLoader = new AsyncURLLoader();
 
 
 tidbitLoader.dataFormat = URLLoaderDataFormat.BINARY;
 
 
 
 
 
 var asyncToken:AsyncToken = tidbitLoader.load(new
 URLRequest(http://localhost/SampleTidbit.swf;));
 
 
 
 
 
 asyncToken.addResponder(this);
 
 
 
 
 
 public function result(resultEvent:Object):void
 
 
 {
 
 
 trace(result);
 
 
 }
 
 
 
 
 
 public function fault(faultEvent:Object):void 
 
 
 {
 
 
 var fault:FaultEvent = faultEvent as FaultEvent;
 
 
 trace(fault:  + fault.toString());
 
 
 }
 
 
 
 
 
 
 
 Is this the right way to approach the problem? Are there existing solutions?
 I would love to hear feedback.
 
 Thanks,
 
 Karthik
 
  
 
 Karthik Kailash | Product
 
 SocialVision, Online Television Becomes a Social Experience
 
 CELL . 408.768.7704  | WEB . www.socialvisioninc.com | FACEBOOK .
 http://www.facebook.com/socialvision facebook.com/socialvision | TWITTER .
 http://twitter.com/socialvision twitter.com/socialvision





[SPAM] Re: [flexcoders] var token:AsyncToken = service.[str](); how to get this working?

2009-12-16 Thread jamesfin





A reminder that pre 3.5sdk there is a bug where the responder can get called 
twice.

Bug SDK-22883 Incorrectly Functioning HTTPService responders are called twice


Steps to reproduce:
1. Run HTTPServiceTest.mxml from the attached zip file. It calls one service 
that should succeed and one service that should fail.
 
Actual Results:
The result and the fault method of the AsyncToken responder are called twice.
 
Expected Results:
Each method should be called only once.
 
Workaround (if any):
Add a result and a fault listener to the HTTPService directly. Then the result 
and the fault method of the AsyncToken responder are called only once as 
expected. 


?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute 
creationComplete=onCreationComplete()
mx:Script
![CDATA[
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.rpc.AsyncToken;

private function onCreationComplete():void {
// should succeed
var token1:AsyncToken = service1.send();
token1.addResponder (new mx.rpc.Responder (result, 
fault));
// should fail
var token2:AsyncToken = service2.send();
token2.addResponder (new mx.rpc.Responder (result, 
fault));
}
private function result(event:Event):void {
out (event.type, ResultEvent(event).messageId);
}
private function fault(event:Event):void {
out (event.type, FaultEvent(event).messageId);
} 
private function out(...args):void {
var newLine:String = args.join ( - );
trace (newLine);
monitor.text = monitor.text + newLine + \n;
} 
private function nothing ():void {}
]]
/mx:Script
mx:HTTPService id=service1 url=http://www.adobe.com; 
resultFormat=text
result=nothing() fault=nothing()/
mx:HTTPService id=service2 url=http://xxx.adobe.com; 
resultFormat=text
result=nothing() fault=nothing()/
mx:Text id=monitor width=100% height=100%/
/mx:Application






--- In flexcoders@yahoogroups.com, Tracy Spratt tr...@... wrote:

 The bracket notation replaces the dot notation:
 
 var token:AsyncToken = service[str] (); //remove the dot
 
 
 
  
 
 Tracy Spratt,
 
 Lariat Services, development services available
 
   _  
 
 From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
 Behalf Of claudiu ursica
 Sent: Tuesday, December 15, 2009 6:31 AM
 To: flexcoders@yahoogroups.com
 Subject: [SPAM] Re: [flexcoders] var token:AsyncToken = service.[str](); how
 to get this working?
 
  
 
   
 
 It is service.send() at least if your service is a HTTPService instance.
 C
 
  
 
   _  
 
 From: MicC chigwel...@...
 To: flexcoders@yahoogroups.com
 Sent: Tue, December 15, 2009 1:08:22 PM
 Subject: [flexcoders] var token:AsyncToken = service.[str](); how to get
 this working?
 
   
 
 When used conventionally - var token:AsyncToken = 
 service.Sel_ all_mgrs( ); - this is service.function, right?
 
 var str:String = 'Sel_all_mgrs' ;
 var token:AsyncToken = service.[str] ();
 token.addResponder( this.responder) ;
 
 What is the correct code to get the above working? TIA,
 
 Mic.





[flexcoders] Re: Compiling Problems...

2009-12-13 Thread jamesfin
After trying different things to no avail, I started editing each file
in my project and voila, everything starts working again!  Clearly an
issue with the FlexBuilder environent.

Anybody ever experienced this issue?




--- In flexcoders@yahoogroups.com, jamesfin james.alan.finni...@...
wrote:

 I've got a really strange issue tonight that I've never seen before...

 I've been working on a project for months and everything has been
compiling fine.  I can debug/etc.  Something changed and the compiler
won't flag any problems in some mxml/as files.  I can enter asdf into
the file and nothing shows up in the Problems tab.  If I perform a
Release export, it gets flagged but doesn't really tell me much other
than there is a problem.

 I've tried starting Eclipse with the -clean but I'm wondering if there
are other places(cache) that needs to be wiped clean somehow.  Perhaps
something more specific to FlexBuilder Eclipse Plug-in?

 Anybody else seen this before?

 Thanks in advance!





[flexcoders] Compiling Problems...

2009-12-12 Thread jamesfin
I've got a really strange issue tonight that I've never seen before...

I've been working on a project for months and everything has been compiling 
fine.  I can debug/etc.  Something changed and the compiler won't flag any 
problems in some mxml/as files.  I can enter asdf into the file and nothing 
shows up in the Problems tab.  If I perform a Release export, it gets flagged 
but doesn't really tell me much other than there is a problem.

I've tried starting Eclipse with the -clean but I'm wondering if there are 
other places(cache) that needs to be wiped clean somehow.  Perhaps something 
more specific to FlexBuilder Eclipse Plug-in?

Anybody else seen this before?

Thanks in advance!






[flexcoders] Re: Starting with Cairngorm or PureMvc

2009-12-01 Thread jamesfin
I have to concur with Chris.  I've been using PureMVC and took a stab at 
Cairngorm and Mate in the beginning but felt they were too tightly coupled with 
Flex, especially Mate.  I'm not an MVC expert but will say that I have enjoyed 
having the strict decoupling which makes managing the code easier.  If you 
think Cairngorm/Mate decouples things which I know they do well, give PureMVC a 
whirl and you will then understand why we are passionate about PureMVC.  We 
don't mind the additional coding that is required to implement an application 
in it as we know that means it is forcing us towards a well architected 
application.

I want to add a shout-out for Fabrication as well.  Fabrication is an add-on 
for the Multi-core version of PureMVC that allows components to be able to send 
notifications from one MVC in one SWF to another MVC in another SWF using 
pipes.  All of this is seamless with standard PureMVC notifications.  Nice!  

Then again, who am I and what do I know. 

$0.02






--- In flexcoders@yahoogroups.com, Chris zomgfore...@... wrote:

 PureMVC is the bomb.
 
 Yes there is boiler plate code but the things it allows you to do is
 very useful. The learning curve is a bit steep if you are not familiar
 with MVC, but it is really, really worth it.
 
 Cairngorm is pretty good, but I felt that the reusability of the code
 wasn't as great as PureMVC. The fact that its language-specific is a
 turn-off for me. I like that I can code PureMVC in pure AS3, Flex, C#
 or Objective C if necessary.
 
 
 Here is a posting on the PureMVC LinkedIn group I did recently that
 may help clarify some points about the benefits of using a framework
 in Flex:
 
 The benefit of using a framework such as PureMVC for us is:
 
 Consistency - Developing, (and especially developing remotely) you
 need to enforce a focused singular vision not only on the project but
 also its structure. A framework allows you to do that.
 Stability - By using a framework you avoid a lot of the pitfalls of
 spaghetti code. One of the unfortunate problems with Flex is that
 while its really really easy to get moving, and perfect for rapid
 prototyping, often these prototypes aren't thrown away, but instead
 built on top of. Things quickly spiral out of control, and you can't
 keep the house standing. I speak from personal experience, and also
 from the experience of others.
 Maintainability - By staying consistent you are able to easily build
 features out using the same tried and true tactics. This means that
 when developer A leaves and Developer B starts, you teach him the 'MVC
 ropes' and they jump right in. This also means other people's code and
 your code take on a similar feel, meaning you feel right at home in
 most of the codebase, including things you didn't write.
 Testing - By utilizing a framework we are able to peel off very
 specific areas of the application and test just them. For example:
 Perhaps you have a 'You have won!' screen at the end of a level. You
 could play through a level to see the screen, or you could create a
 special demo Mediator that pretends to win the level and immediately
 displays the view and just test that.
 
 * What are the limitations or cons of using a Framework with Flex 3?
 
 I would say that the most difficult thing is there is a lot of boiler
 plate code. Things in PureMVC are very loosely coupled, and the price
 of this loose coupling is that you need to add a bit more code.
 
 * Do I really need to use a Framework, or does Flex 3 have what it
 takes out of the box?
 
 YES you need a framework. Flex out of the box for anything beyond
 small applications quickly becomes unmanageable. Even using frameworks
 like Cairngorm can become overwhelmed if you plan to fork code.
 
 
 
 On Tue, Dec 1, 2009 at 10:42 AM, Richard Rodseth rrods...@... wrote:
 
 
 
  Personally, I like Mate and suggest you check it out before committing to 
  either of those too.
 
  On Tue, Dec 1, 2009 at 8:16 AM, Christophe christophe_jacque...@... wrote:
 
 
 
  Hello,
 
  Is it easy to learn and use Cairngorm or PureMvc. I have a one year 
  application and I would like to use these frameworks to structured it.
 
  Thank you,
  Christophe,
 
 
 





[flexcoders] Re: Starting with Cairngorm or PureMvc

2009-12-01 Thread jamesfin
Thanks for the honest reply Richard.

You are very correct in that we are talking about a Flex application here.  
However, I also am involved in an equivalent iPhone application and am using 
the iPhone port of PureMVC.  It was easier to convert the Flex app. to the 
already complex iPhone architecture with PureMVC.  Since PureMVC is available 
for most any environment, it's a safe-bet in the end too cause you never know 
when you may need to port your app.

No harm, no foul. ;)



--- In flexcoders@yahoogroups.com, Richard Rodseth rrods...@... wrote:

 Not to disparage PureMVC (glad it works for you), but I don't really get the
 significance of the fact that it's not Flex-specific. We're developing Flex
 apps.
 
 One complaint I have about Mate is that the lack of strong typing in the
 event map can certainly trip you up.
 
 On Tue, Dec 1, 2009 at 10:31 AM, jamesfin james.alan.finni...@...wrote:
 
 
 
  I have to concur with Chris. I've been using PureMVC and took a stab at
  Cairngorm and Mate in the beginning but felt they were too tightly coupled
  with Flex, especially Mate. I'm not an MVC expert but will say that I have
  enjoyed having the strict decoupling which makes managing the code easier.
  If you think Cairngorm/Mate decouples things which I know they do well, give
  PureMVC a whirl and you will then understand why we are passionate about
  PureMVC. We don't mind the additional coding that is required to implement
  an application in it as we know that means it is forcing us towards a well
  architected application.
 
  I want to add a shout-out for Fabrication as well. Fabrication is an add-on
  for the Multi-core version of PureMVC that allows components to be able to
  send notifications from one MVC in one SWF to another MVC in another SWF
  using pipes. All of this is seamless with standard PureMVC notifications.
  Nice!
 
  Then again, who am I and what do I know.
 
  $0.02
 
 
  --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Chris
  zomgforeelz@ wrote:
  
   PureMVC is the bomb.
  
   Yes there is boiler plate code but the things it allows you to do is
   very useful. The learning curve is a bit steep if you are not familiar
   with MVC, but it is really, really worth it.
  
   Cairngorm is pretty good, but I felt that the reusability of the code
   wasn't as great as PureMVC. The fact that its language-specific is a
   turn-off for me. I like that I can code PureMVC in pure AS3, Flex, C#
   or Objective C if necessary.
  
  
   Here is a posting on the PureMVC LinkedIn group I did recently that
   may help clarify some points about the benefits of using a framework
   in Flex:
  
   The benefit of using a framework such as PureMVC for us is:
  
   Consistency - Developing, (and especially developing remotely) you
   need to enforce a focused singular vision not only on the project but
   also its structure. A framework allows you to do that.
   Stability - By using a framework you avoid a lot of the pitfalls of
   spaghetti code. One of the unfortunate problems with Flex is that
   while its really really easy to get moving, and perfect for rapid
   prototyping, often these prototypes aren't thrown away, but instead
   built on top of. Things quickly spiral out of control, and you can't
   keep the house standing. I speak from personal experience, and also
   from the experience of others.
   Maintainability - By staying consistent you are able to easily build
   features out using the same tried and true tactics. This means that
   when developer A leaves and Developer B starts, you teach him the 'MVC
   ropes' and they jump right in. This also means other people's code and
   your code take on a similar feel, meaning you feel right at home in
   most of the codebase, including things you didn't write.
   Testing - By utilizing a framework we are able to peel off very
   specific areas of the application and test just them. For example:
   Perhaps you have a 'You have won!' screen at the end of a level. You
   could play through a level to see the screen, or you could create a
   special demo Mediator that pretends to win the level and immediately
   displays the view and just test that.
  
   * What are the limitations or cons of using a Framework with Flex 3?
  
   I would say that the most difficult thing is there is a lot of boiler
   plate code. Things in PureMVC are very loosely coupled, and the price
   of this loose coupling is that you need to add a bit more code.
  
   * Do I really need to use a Framework, or does Flex 3 have what it
   takes out of the box?
  
   YES you need a framework. Flex out of the box for anything beyond
   small applications quickly becomes unmanageable. Even using frameworks
   like Cairngorm can become overwhelmed if you plan to fork code.
  
  
  
   On Tue, Dec 1, 2009 at 10:42 AM, Richard Rodseth rrodseth@ wrote:
   
   
   
Personally, I like Mate and suggest you check it out before committing
  to either of those too

[flexcoders] Re: Simple Layout Question

2009-11-30 Thread jamesfin


Copy / paste this and it will help you along...



?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;


mx:VBox backgroundColor=0xff
mx:HBox backgroundColor=0x00ff00
mx:Button label=Test 1/
mx:Button label=Test 1/
mx:Button label=Test 1/
mx:Button label=Test 1/
/mx:HBox

mx:Canvas backgroundColor=0xff width=100% id=testCanvas

mx:constraintColumns
mx:ConstraintColumn id=col1 width=50 /
/mx:constraintColumns

mx:Button id=button2 label=Test 2 left={slider.value}/
/mx:Canvas

mx:HBox paddingLeft=0 horizontalGap=0
mx:Spacer width={slider.value}/
mx:Button label=Test 3 /
/mx:HBox
/mx:VBox


 mx:HSlider id=slider
minimum=0
maximum={testCanvas.width - button2.width}
value=200
liveDragging=true
snapInterval=1
tickInterval=20
dataTipPrecision=0 /

   
/mx:Application



--- In flexcoders@yahoogroups.com, Rich Christiansen warpr...@... wrote:

 Hey all,
 
 I just recently started working with Flex (3), and I've got a simple 
 layout question.
 
 I've got a bunch of components inside of a vbox, and I've noticed that 
 the vbox positions them so they are all at the same x coordinate.  How 
 can I change the x-position (e.g. the indentation) of the components?
 
 Here's some test code I've been fiddling with:
 
 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
 
 mx:VBox backgroundColor=0xff
 mx:HBox backgroundColor=0x00ff00
 mx:Button label=Test 1/
 mx:Button label=Test 1/
 mx:Button label=Test 1/
 mx:Button label=Test 1/
 /mx:HBox
 
 mx:Canvas backgroundColor=0xff 
 mx:Button label=Test 2/
 /mx:Canvas
 
 mx:Button label=Test 3 /
 /mx:VBox

 /mx:Application
 
 How can I make it so that the blue and red buttons are indented, say, 50 
 pixels?  I've already tried fiddling with the 'left' and 'paddingLeft' 
 attributes with little success... :/
 
 Any thoughts?  This has got to be possible with VBox, but I can't seem 
 to figure it out...
 
 Thanks,
 -Rich





[flexcoders] Re: Simple Layout Question

2009-11-30 Thread jamesfin
Here's a version that uses the constraintColumn...


?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;


mx:VBox backgroundColor=0xff
mx:HBox backgroundColor=0x00ff00
mx:Button label=Test 1/
mx:Button label=Test 1/
mx:Button label=Test 1/
mx:Button label=Test 1/
/mx:HBox


mx:Canvas backgroundColor=0xff width=100% id=testCanvas

mx:constraintColumns
mx:ConstraintColumn id=col1 width={slider.value} /
/mx:constraintColumns

mx:Button id=button2 label=Test 2 left=col1:{slider.value}/
/mx:Canvas

mx:HBox paddingLeft=0 horizontalGap=0
mx:Spacer width={slider.value}/
mx:Button label=Test 3 left=col1:0/
/mx:HBox
/mx:VBox


 mx:HSlider id=slider
minimum=0
maximum={testCanvas.width - button2.width}

liveDragging=true
snapInterval=1
tickInterval=20
dataTipPrecision=0 /

   
/mx:Application




--- In flexcoders@yahoogroups.com, jamesfin james.alan.finni...@... wrote:

 
 
 Copy / paste this and it will help you along...
 
 
 
 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
 
 
 mx:VBox backgroundColor=0xff
 mx:HBox backgroundColor=0x00ff00
 mx:Button label=Test 1/
 mx:Button label=Test 1/
 mx:Button label=Test 1/
 mx:Button label=Test 1/
 /mx:HBox
 
 mx:Canvas backgroundColor=0xff width=100% id=testCanvas
 
   mx:constraintColumns
   mx:ConstraintColumn id=col1 width=50 /
   /mx:constraintColumns
 
 mx:Button id=button2 label=Test 2 left={slider.value}/
 /mx:Canvas
 
   mx:HBox paddingLeft=0 horizontalGap=0
   mx:Spacer width={slider.value}/
   mx:Button label=Test 3 /
   /mx:HBox
 /mx:VBox
 
 
  mx:HSlider id=slider
 minimum=0
 maximum={testCanvas.width - button2.width}
 value=200
 liveDragging=true
 snapInterval=1
 tickInterval=20
 dataTipPrecision=0 /
 

 /mx:Application
 
 
 
 --- In flexcoders@yahoogroups.com, Rich Christiansen warproof@ wrote:
 
  Hey all,
  
  I just recently started working with Flex (3), and I've got a simple 
  layout question.
  
  I've got a bunch of components inside of a vbox, and I've noticed that 
  the vbox positions them so they are all at the same x coordinate.  How 
  can I change the x-position (e.g. the indentation) of the components?
  
  Here's some test code I've been fiddling with:
  
  ?xml version=1.0 encoding=utf-8?
  mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
  
  mx:VBox backgroundColor=0xff
  mx:HBox backgroundColor=0x00ff00
  mx:Button label=Test 1/
  mx:Button label=Test 1/
  mx:Button label=Test 1/
  mx:Button label=Test 1/
  /mx:HBox
  
  mx:Canvas backgroundColor=0xff 
  mx:Button label=Test 2/
  /mx:Canvas
  
  mx:Button label=Test 3 /
  /mx:VBox
 
  /mx:Application
  
  How can I make it so that the blue and red buttons are indented, say, 50 
  pixels?  I've already tried fiddling with the 'left' and 'paddingLeft' 
  attributes with little success... :/
  
  Any thoughts?  This has got to be possible with VBox, but I can't seem 
  to figure it out...
  
  Thanks,
  -Rich
 





[flexcoders] Re: how to get an array as a part from another array?

2009-11-25 Thread jamesfin


private function seniorsOnly(person:*, index:int, arr:Array):Boolean{
return (person.isSenior == true?true:false);
}


private function init():void{

var ac:ArrayCollection = new ArrayCollection([
{id:1, name:bob, sex:m, isSenior:true},
{id:2, name:kathy, sex:f, isSenior:false},
{id:3, name:joe, sex:m, isSenior:false},
{id:4, name:barb, sex:f, isSenior:true},
{id:5, name:pete, sex:m, isSenior:true}
]);


var seniors:Array = 
ac.toArray().filter(seniorsOnly);







--- In flexcoders@yahoogroups.com, turbo_vb timh...@... wrote:

 Could use a filterFunction.
 
 -TH
 
 --- In flexcoders@yahoogroups.com, coder3 rrhuang@ wrote:
 
  
  Hi All,
  
  I have a ArrayCollection, it contains id, name, sex, isSenior, etc.
  now i only need an array of id through that list. what's the quickest way
  to get an array of ids if isSenior is true, without using a loop?
  
  thanks
  
  C
  
  -- 
  View this message in context: 
  http://old.nabble.com/how-to-get-an-array-as-a-part-from-another-array--tp26519700p26519700.html
  Sent from the FlexCoders mailing list archive at Nabble.com.
 





[flexcoders] Re: how to get an array as a part from another array?

2009-11-25 Thread jamesfin

too much fun


private var _arr:Array = new Array();

private function init():void{

var ac:ArrayCollection = new ArrayCollection([
{id:1, name:bob, sex:m, isSenior:true},
{id:2, name:kathy, sex:f, isSenior:false},
{id:3, name:joe, sex:m, isSenior:false},
{id:4, name:barb, sex:f, isSenior:true},
{id:5, name:pete, sex:m, isSenior:true}
]);

ac.toArray().filter(seniorsOnly);
}

private function seniorsOnly(person:*, index:int, 
arr:Array):Boolean{

return(person.isSenior?_arr.push(person.id):false);
}




--- In flexcoders@yahoogroups.com, turbo_vb timh...@... wrote:

 Seems like it might be about the same amount of code though:
 
 var myIdArray:Array = [];
 
 for each ( var myObject:MyObject in myArrayCollection )
 
 {
 
   if ( myObject.isSenior ) myIdArray.push( myObject.id );
 
 }
 
 
 
 
 -TH
 
 
 
 --- In flexcoders@yahoogroups.com, coder3 rrhuang@ wrote:
 
 
  right. filtering is a loop actually. but it just keep our code look
 more
  clean.
 
  all right, i guest there is no short cut to get the partial array.
 
  thanks
 
 
 
  turbo_vb wrote:
  
   Nope, going to have to loop and create the new array manually.  Even
 using
   a filterFunction is still looping; behind the scenes.
  
   -TH
  
   --- In flexcoders@yahoogroups.com, coder3 rrhuang@ wrote:
  
  
   by using a filter funtion can return you the array with
 isSenior==true;
  
   but i need an arry of id's only.
   in this case,
   i need an returned array like this:
   [1, 4, 5]
  
  
   not
   [ {id:1, name:bob, sex:m, isSenior:true},
   {id:4, name:barb, sex:f, isSenior:true},
   {id:5, name:pete, sex:m, isSenior:true}
   ]
  
  
   can i do that without a loop?
  
  
  
  
   jamesfin-2 wrote:
   
   
   
 private function seniorsOnly(person:*, index:int,
 arr:Array):Boolean{
return (person.isSenior == true?true:false);
   }
   
   
   private function init():void{
   
var ac:ArrayCollection = new ArrayCollection([
{id:1, name:bob, sex:m, isSenior:true},
{id:2, name:kathy, sex:f, isSenior:false},
{id:3, name:joe, sex:m, isSenior:false},
{id:4, name:barb, sex:f, isSenior:true},
{id:5, name:pete, sex:m, isSenior:true}
]);
   
   
var seniors:Array = ac.toArray().filter(seniorsOnly);
   
   
   
   
   
   
   
--- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote:
   
Could use a filterFunction.
   
-TH
   
--- In flexcoders@yahoogroups.com, coder3 rrhuang@ wrote:


 Hi All,

 I have a ArrayCollection, it contains id, name, sex,
   isSenior,
etc.
 now i only need an array of id through that list. what's the
   quickest
way
 to get an array of ids if isSenior is true, without using
 a
   loop?

 thanks

 C

 --
 View this message in context:
   
  
 http://old.nabble.com/how-to-get-an-array-as-a-part-from-another-array--\
 tp26519700p26519700.html
 Sent from the FlexCoders mailing list archive at Nabble.com.

   
   
   
   
   
  
   --
   View this message in context:
  
 http://old.nabble.com/how-to-get-an-array-as-a-part-from-another-array--\
 tp26519700p26521572.html
   Sent from the FlexCoders mailing list archive at Nabble.com.
  
  
  
  
  
 
  --
  View this message in context:
 http://old.nabble.com/how-to-get-an-array-as-a-part-from-another-array--\
 tp26519700p26521778.html
  Sent from the FlexCoders mailing list archive at Nabble.com.
 





[flexcoders] Re: HorizontalList itemRenderer size does not resize on refresh

2009-11-20 Thread jamesfin



I had a similar predicament recently...

In my renderer code, I setup a listener to respond to external data changes.  
In my case, I just needed to call invalidateDisplayList but you could reset 
your sizes/etc. based upon the new data.


ReportHorizontalList(this.parent.parent).dataProvider.addEventListener(CollectionEvent.COLLECTION_CHANGE,
 outsideCollectionChanged);

private function outsideCollectionChanged(evt:CollectionEvent):void{
invalidateDisplayList();
}



--- In flexcoders@yahoogroups.com, mattgarland2000 al...@... wrote:

 I am using a horizontallist as an answer bar in an e-learning app. The 
 designer wants the answer boxes to stretch according to content (all should 
 have the same size, and there is a minimum).
 
 This works fine when the dataProvider is set. BUT there is another 
 requirement: after a wrong answer is clicked, there is feedback and the 
 answers are scrambled. 
 
   protected function tryAgain(event:Event):void
   {
   
 answers=CollectionUtils.noRepeatRandomizeXMLList(answers);
   answerListRef.dataProvider=answers;
   } 
 
 After the scrambling, the text values are represented in their new places, 
 and the itemRenderers are resized--but all at the minimum size, so any over 
 the min size need scrollbars. The resize code is called it seems before the 
 data is set. 
 
 I should mention that I have a similar vertical list, with 
 variableRowHeight set to true as well, and there the same code works fine. 
 
 How do I force the HorizontalList to resize the renderers en masse after the 
 new text values are set?





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

2009-11-20 Thread jamesfin

This should get you on your way...

http://livedocs.adobe.com/flex/3/html/help.html?content=databinding_4.html



--- In flexcoders@yahoogroups.com, luvfotography ygro...@... wrote:

 I've declared a [Bindable] private var changeme:Boolean;
 
 Is there a way to execute a function whenever this var changes?
 
 thanks,





[flexcoders] Re: constraintColumns/constraintRows on extended Sprite object REFdn6025643069

2009-11-18 Thread jamesfin


You can always do this where the right / top is constraining the item.


?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute 
creationComplete=init()


mx:Script
![CDATA[
import mx.core.UIComponent;

private function init():void{

var spTest:Sprite = new Sprite();
spTest.graphics.beginFill(0xFF);
spTest.graphics.drawRect(0, 0, 100, 100);
spTest.graphics.endFill();
logo.rawChildren.addChild(spTest);
}

]]
/mx:Script
mx:Canvas width=100 height=100 right=20 top=20 id=logo/

/mx:Application



--- In flexcoders@yahoogroups.com, dennis den...@... wrote:

 Hello people..
 
  
 
 I have an extended Sprite object and I put in on the Stage (via addChild).
 
 How may I anchor it on runtime on the Stage? 
 
 How may I constraint it in Columns and Rows?
 
  
 
 Suppose that I want a Sprite(Panel) object, to be always 20 pixels from
 right edge of the Stage, even if the Stage resized.
 
  
 
 Thank in advance.
 
 Dennis





[flexcoders] Re: Progress for synchronous operation

2009-11-18 Thread jamesfin
It depends on what you want to display.  If you put up some kind of progress or 
other status UI then immediately jump into your sync. operation, it's unlikely 
the status UI will have been rendered by the time you entered it.  No different 
than an infinite loop in the flash player.

A couple of ideas...that I've cooked up before.

1. Break up your sync. operation by using a timer or enter frame

2. Put up a Please Wait UI and when that is visible, fire off a timer to do 
your sync. work.

A reminder that Flex is event driven so if you don't let events fly, nothing 
will fly.


I'm sure there are other options but I run across these often.



--- In flexcoders@yahoogroups.com, Richard Rodseth rrods...@... wrote:

 I'm really stumped by this. Is there *any* way I can display a busy during
 a long-running *synchronous* operation?
 
 On Mon, Nov 16, 2009 at 10:29 AM, Richard Rodseth rrods...@...wrote:
 
  Can anyone suggest a solution?
 
 
  On Wed, Nov 11, 2009 at 3:23 PM, Richard Rodseth rrods...@...wrote:
 
  So I tried this pattern:
 
  private function onClickSave(event:Event):void {
 
CursorManager.setBusyCursor();
 var generatePDF:Function = function(e:Event):void {
  
savePDF(bytes);
  };
 
   // Delay start so cursor can display
  var timer:Timer = new Timer(1, 1);
  timer.addEventListener(TimerEvent.TIMER, generatePDF);
  timer.start();
  }
 
  private function savePDF(pdfBinary:ByteArray):void {
  var fileRef:FileReference = new FileReference();
  fileRef.save(pdfBinary,MyReport.pdf);
  }
 
  But then of course I get the security error below from savePDF:
 
  Error: Error #2176: Certain actions, such as those that display a pop-up
  window, may only be invoked upon user interaction, for example by a mouse
  click or button press.
  at flash.net::FileReference/_save()
 
  Any good ideas for displaying a busy cursor or indeterminate progress bar
  while doing a long-running synchronous operation?
 
 
  On Wed, Nov 11, 2009 at 9:59 AM, Richard Rodseth rrods...@...wrote:
 
  Thanks. Yes, I wasn't expecting to show dynamically-updating progress
  during the synchronous operation. Just wanted to pop up something (or 
  change
  the cursor) before, and remove it after. I'll take a closer look at the
  AlivePDF docs.
 
 
  On Wed, Nov 11, 2009 at 6:24 AM, ag_rcuren robert.vancuren...@...
   wrote:
 
 
 
  I am not fully sure how AlivePDF works because I have never used it but
  I thought that it could be done asynchronously because I saw a complete
  event in the documentation that reads:
  Dispatched when PDF has been generated and available. The save() method
  generate this event
 
  That to me says that it can be generated asynchronously but like I said
  I really dont know.
 
  As far as showing progress during a synchronous call it is not possible.
  This is because the synchronous call does not return until it is done and
  thus the UI will never get a chance to update during the process.
 
  If you want to show something before that is possible. You could use a
  timer or you may want to look at the callLater method of displayObject as
  this will wait one frame before calling the method you want. This would
  allow you to show say a pop up or something so they user could at least 
  see
  something.
 
 
  --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com,
  Richard Rodseth rrodseth@ wrote:
  
   What's a good way to display progress or a busy cursor for a
  potentially
   long-running, but synchronous operation (in my case generating a PDF
  using
   AlivePDF) ?
  
   As noted here, CursorManager.setBusyCursor doesn't display the cursor
  until
   there is no code running, and PopupManager seems to act similarly.
  
   Defer initiation of the operation using a timer?
  
 
   
 
 
 
 
 





[flexcoders] Re: how to update a progress bar when uploading an image

2009-11-17 Thread jamesfin

There isn't a way to do this.  You can simulate a progress bar but for whatever 
reason, this functionality doesn't exist.  If you have a look at speedtest.net, 
they show download progress nicely but their upload progress is simulated.

I've thought about making another (different) request to the server to get the 
number of bytes transferred, but that's a nasty hack.  It also depends on how 
big your files that are being uploaded.  If they are all fairly large then that 
might work for you.

Perhaps someone can explain the limitations within the browser framework to 
help us understand why we can't get upload status.  Alternatively, if you are 
ambitious, go get the Firefox source Firefox and figure it out for yourself.

Anyone else have a different opinion/solution?



--- In flexcoders@yahoogroups.com, stinasius stinas...@... wrote:

 hi, am trying to upload and image and i would like to show progress while 
 uploading process goes on by updating the progress bar but the progress bar 
 seems not to get updated. here is my code
 
 formitem component
 ?xml version=1.0 encoding=utf-8?
 mx:FormItem xmlns:mx=http://www.adobe.com/2006/mxml; 
 creationComplete=init()
   
   mx:Script
   ![CDATA[
   import mx.managers.PopUpManager;
   import components.progress_popup;
   
   private var fileRef:FileReference;
   private var progress_win:progress_popup;
   
   private function init():void{
   fileRef = new FileReference();
   fileRef.addEventListener(Event.SELECT, fileRef_select);
   fileRef.addEventListener(ProgressEvent.PROGRESS, 
 progressHandler);
   fileRef.addEventListener(Event.COMPLETE, 
 fileRef_complete);
   }
   
   private function browseAndUpload():void{
   fileRef.browse();
   message.text = ;
   }
 
   private function fileRef_select(event:Event):void{
   var request:URLRequest = new 
 URLRequest(cfcs/upload.cfm)
   try 
   {
   fileRef.upload(request);
   } 
   catch (err:Error)
   {
   message.text = ERROR: zero-byte file;
   }   
   memPhoto.text = event.currentTarget.name;
   createdprogressPopup();
   progress_win.uploadProgress.setProgress(0, 100);
   progress_win.uploadProgress.label = Loading 0%;
   }
   
   private function fileRef_complete(event:Event):void{
   message.text +=  (complete);
   removeMe();
   }
   
   private function createdprogressPopup():void{
   
 progress_win=progress_popup(PopUpManager.createPopUp(this,progress_popup,true));
   }
   
   private function removeMe():void {
   PopUpManager.removePopUp(progress_win);
   }
   
   private function progressHandler(event:ProgressEvent):void{
   //var file:FileReference = FileReference(event.target);
   
 progress_win.uploadProgress.setProgress(event.bytesLoaded, event.bytesTotal); 
   
   }
   
   ]]
   /mx:Script
   
   mx:HBox width=240
   mx:TextInput width=155 id=memPhoto enabled=false/
   mx:Button label=Browse click=browseAndUpload();/  
 
   /mx:HBox
   mx:Label id=message/
 /mx:FormItem
 
 popup with progress bar to show progress
 
 ?xml version=1.0 encoding=utf-8?
 mx:TitleWindow xmlns:mx=http://www.adobe.com/2006/mxml; layout=vertical 
 creationCompleteEffect={customMove} removedEffect={customHide} 
 title=Uploading Image
   mx:Script
   ![CDATA[
   import mx.managers.PopUpManager;
   import mx.effects.easing.*;
   ]]
   /mx:Script
 
   
   mx:Parallel id=customMove target={this}
 mx:Move yFrom=0 xFrom={(stage.width  - this.width) / 2} 
 xTo={(stage.width  - this.width) / 2} yTo={(stage.height - this.height) / 
 2} easingFunction=Elastic.easeOut duration=500 /
   mx:Fade duration=500 /
 /mx:Parallel
 
 mx:Parallel id=customHide target={this}
 mx:Move yFrom={(stage.height - this.height) / 2} 
 xFrom={(stage.width  - this.width) / 2} xTo={(stage.width  - this.width) / 
 2} yTo={stage.height} duration=500 /
   mx:Fade alphaFrom=1 alphaTo=0 duration=500 /
 

[flexcoders] Re: how to update a progress bar when uploading an image

2009-11-17 Thread jamesfin

This also assumes you are trying to upload text vs. binary depending on how 
your server is configured.

This is an example that you might be able to leverage if you have binary.

http://www.adobe.com/devnet/flex/articles/file_upload_05.html


--- In flexcoders@yahoogroups.com, stinasius stinas...@... wrote:

 wow... so the only way is to use the indeterminate to show that smething is 
 happening. thanks but in case someone has a solution please share. thanks 
 again





[flexcoders] Re: first tile of tilelist does not show up

2009-11-17 Thread jamesfin
Move the setImage into commitProperties and you should be good to go...


override protected function commitProperties():void{

super.commitProperties();

setImage(); 

}


--- In flexcoders@yahoogroups.com, mattgarland2000 al...@... wrote:

 I have a component which breaks up a picture into a tilelist. It works great, 
 except, the first picture does not show up.
 
 The renderer is a canvas with an image (subclasses add other images). It 
 grabs the appropriate image from the parent component. (This image is 
 dynamically created from a loaded image). 
 
 Here is the renderer:
 
   override public function set data(value:Object):void
   {
   _data=value;
   invalidateProperties();
   dispatchEvent(new 
 FlexEvent(FlexEvent.DATA_CHANGE));
   }
 
   [Bindable(dataChange)]
   override public function get data():Object
   {
   return _data;
   }
 
   [Bindable(dataChange)]
   public function get listData():BaseListData
   {
   return _listData;
   }
 
   public function set listData(value:BaseListData):void
   {
   _listData=value;
   list=listData.owner as TilePicture;
   }
 
   protected function setImage():void
   {
   image.source=list.imageFromRenderer(this);
   }
 
   override protected function 
 updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
   {
   super.updateDisplayList(this.unscaledWidth, 
 this.unscaledHeight);
   setImage();
   }
 
 Things I have tried:
 
 1) in the parent, resetting the dp to force an update
 2) forcing an update via dataChange
 3) binding the image's source
 
 These don't work. Not sure what to try next. Occasionaly and unpredictably, 
 the image will update when 1) in a subclassed renderer, a second image is 
 changed. But usually no amount of  interaction will make the first tile 
 appear.





[flexcoders] Re: first tile of tilelist does not show up

2009-11-17 Thread jamesfin
Put this code in and see if an image appears in the first slot.  If so, your 
image source logic is incorrect.

test.png is a sample image...

[Embed(source=test.png)]
[Bindable]
public static var testImage:Class;

override protected function commitProperties():void{

super.commitProperties();
image.source=testImage;

}





--- In flexcoders@yahoogroups.com, mattgarland2000 al...@... wrote:

 
 
 Thanks, that makes sense, but it does not work here, unfortunately. I think I 
 might try to defining some states for the renderer and see if using states 
 takes care of this if it is some weird timing/updating issue.
 
 --- In flexcoders@yahoogroups.com, jamesfin james.alan.finnigan@ wrote:
 
  Move the setImage into commitProperties and you should be good to go...
  
  
  override protected function commitProperties():void{
  
  super.commitProperties();
  
  setImage(); 
  
  }
  
  
  --- In flexcoders@yahoogroups.com, mattgarland2000 alias@ wrote:
  
   I have a component which breaks up a picture into a tilelist. It works 
   great, except, the first picture does not show up.
   
   The renderer is a canvas with an image (subclasses add other images). It 
   grabs the appropriate image from the parent component. (This image is 
   dynamically created from a loaded image). 
   
   Here is the renderer:
   
 override public function set data(value:Object):void
 {
 _data=value;
 invalidateProperties();
 dispatchEvent(new 
   FlexEvent(FlexEvent.DATA_CHANGE));
 }
   
 [Bindable(dataChange)]
 override public function get data():Object
 {
 return _data;
 }
   
 [Bindable(dataChange)]
 public function get listData():BaseListData
 {
 return _listData;
 }
   
 public function set listData(value:BaseListData):void
 {
 _listData=value;
 list=listData.owner as TilePicture;
 }
   
 protected function setImage():void
 {
 image.source=list.imageFromRenderer(this);
 }
   
 override protected function 
   updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
 {
 super.updateDisplayList(this.unscaledWidth, 
   this.unscaledHeight);
 setImage();
 }
   
   Things I have tried:
   
   1) in the parent, resetting the dp to force an update
   2) forcing an update via dataChange
   3) binding the image's source
   
   These don't work. Not sure what to try next. Occasionaly and 
   unpredictably, the image will update when 1) in a subclassed renderer, a 
   second image is changed. But usually no amount of  interaction will make 
   the first tile appear.
  
 





[flexcoders] Re: In a Label field, if the text is too long it ends with ..... , however if you ..

2009-11-17 Thread jamesfin
This was of help to me a while back...

http://thanksmister.com/index.php/archive/flex-truncating-html-text




--- In flexcoders@yahoogroups.com, luvfotography ygro...@... wrote:

 If the Label control size is smaller than its text, the text of the Label 
 control is truncated using a localizable string, such as 
 
 However if you set the text with htmlText, then you do not get the '...' How 
 can I set the text of the Label field  with htmlText and still get the '...' 
 if my text is too long?
 
 ex: 
 
 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute
   mx:Label x=37 y=35 text=label field width=193 id=myLabel/
   mx:Button x=37 y=91 label=change Label Text  click=myLabel.text 
 = myTextInput.text/
   mx:Button x=184 y=91 label=change Label with HtmlText  
 click=myLabel.htmlText = myTextInput.text/
   mx:TextInput id=myTextInput text=This is a really long label text 
 it should truncate in periods x=37 y=61/
 /mx:Application





[flexcoders] Re: Repeating background for a component

2009-11-16 Thread jamesfin



var repeat:RepeatBackground = new RepeatBackground();
addChild(repeat);
repeat.percentHeight = 100;
repeat.percentWidth = 100;




package
{
import mx.containers.Canvas;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Graphics;
import flash.display.Loader;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.geom.Matrix;
import flash.net.URLRequest;
import flash.display.Sprite;

import mx.controls.Image;
import mx.core.BitmapAsset;
import mx.graphics.RectangularDropShadow;
import mx.skins.RectangularBorder;
import mx.core.Application;
import mx.core.UIComponent;

public class RepeatBackground extends Canvas
{
public function RepeatBackground()
{
super();
}

private var tile:BitmapData;

[Embed(source='assets/main_bg.png')]
private var imgCls:Class;

override protected function updateDisplayList(unscaledWidth:Number, 
unscaledHeight:Number):void {
super.updateDisplayList(unscaledWidth, unscaledHeight);

if( this.parent != null ) {
if( imgCls == null ) {
var backgroundImage:Object = UIComponent( this.parent 
).getStyle( backgroundImage );
if( backgroundImage != null  backgroundImage !=  ) {
imgCls = Class( backgroundImage );
(this.parent as UIComponent).setStyle( 
backgroundImage,  );
}
}
if( imgCls != null ) {
try {
var background:BitmapAsset = BitmapAsset(new imgCls());
tile = background.bitmapData;

var transform: Matrix = new Matrix();

alpha = .5;
graphics.clear();
graphics.beginBitmapFill(tile, transform, true, true);
graphics.drawRect(0, 0, unscaledWidth, unscaledHeight);
} catch( e:TypeError ) {
// Throw an custom error if imgCls is not a valid type
throw new Error( backgroundImage value is not a valid 
image class );
} finally {
;// Catch all just ignore
}
}
}
}


}
}



--- In flexcoders@yahoogroups.com, Wally Kolcz wko...@... wrote:

 Does anyone know, or have a link to an example, for a tutorial on how to 
 repeat a background for a component? I want to apply a repeating texture to 
 either a Canvas or VBox but cannot seem to find a good working example. Found 
 a ton that work for the Application. Thanks!





[flexcoders] Re: The Alert box is at the Top Left.

2009-11-13 Thread jamesfin


 You can always just move the Alert yourself...

 private function popUpAlert():void{

var myMenu:Menu = new Menu();
var popUpButton:PopUpButton = new PopUpButton();
 addChild(popUpButton);
 popUpButton.x = this.width / 2;
 popUpButton.y = this.height / 2;

var dp:Object = [{label: Alpha}, {label: Beta}, {label: 
Gamma}];   
myMenu.dataProvider = dp;
myMenu.selectedIndex = 0;  
myMenu.addEventListener(itemClick, itemClickHandler);
popUpButton.popUp = myMenu;
}

private function itemClickHandler(evt:MenuEvent):void{

var alert:Alert = Alert.show(Are you sure? \n\n There is no 
Un-Do,
'Delete *All Completed* ?',
Alert.YES| Alert.NO,
null,
responseToDeleteAllCompletedHandler,
null,
Alert.NO);

alert.move (parentDocument.width / 2 - alert.width/2, 
parentDocument.height /2 - alert.height / 2);   
}
   
private function 
responseToDeleteAllCompletedHandler(evt:CloseEvent):void{
   
if(evt.detail == Alert.YES)
trace(Yes);
else
trace(No);




--- In flexcoders@yahoogroups.com, steveb805 quantumcheese...@... wrote:

 Thanks TH.  That's weird, there must be something else in my code, then as  
 I'm still not able to get it to the center.
  
 My hierarchy in my main.mxml is
  mx.Application  mainPanel  myPopupButton
 
 I tried 
   this.parent as Sprite
   and 
   mainPanel.parent as Sprite
 
 And a couple of other things..
 
 TH,
 I'm not waiting on a solution from you specifically, because you were just 
 explaining the facts about the popup specifically, and the need to cast that 
 parameter.
 
 Maybe someone else will see this who has run into this specific situation.
 
 Steve
  
 
 
 --- In flexcoders@yahoogroups.com, turbo_vb TimHoff@ wrote:
 
  Hi Steve,
  Popups exist outside the normal DisplayList, so you can work around it
  by setting the Alert's parent like this:
  Alert.show(your text, your title, 4, parentApplication as Sprite);
  -TH
  --- In flexcoders@yahoogroups.com, steveb805 
  wrote:
  
   Seems like until now, my Alert boxes appear in the center ok.
  
   However, now that I am using a PopUpButton, and in response to one of
  the menu item clicks I am calling Alert.show(), the popup box is stuck
  at the upper left.
  
   My popupbutton handler:
  
   private function itemClickHandler(event:MenuEvent):void {
   switch (event.index) {
  case 0:
   ...
   case 1:
   Alert.show( Are you sure? \n\n  There is no Un-Do,
 'Delete *All Completed* ?',
 Alert.YES| Alert.NO,
 null,
 responseToDeleteAllCompletedHandler,
 null,
 Alert.NO);
   default:
   }
   }
  
  
   For the parent parameter - which is supposed to be a Sprite - I tried
  this.parent, hoping this would fix it, but complained of type mismatch.
  
   Weird that the Alert works fine when calling it in response to normal
  buttons on my main panel, but all of a sudden the Alert is confused
  about the parent when calling the Alert.show in response to a *popup*
  type button.
  
   ( maybe I should download an updated Flex sdk?  it's been a couple of
  months)
  
   Any advice would help
   tx,
   Steve