Re: [flexcoders] FileReference.load()

2009-07-27 Thread Tom Chiverton
On Thursday 23 Jul 2009, Richard Rodseth wrote:
 Thanks for the explanation. More or less what I expected until Gordon made
 his suggestion.
 I think I have approval to require 10, but I'd still be interested to know
 if Gordon concurs with your conclusion.

Could you just alter the JavaScript wrapper to use the v9 or v10 version of 
your app, depending on what is installed in the client ?
You can still compile both from the same source code, it seems, and have 
different code paths taken depending if the the code is running on v9 or v10 
player.

-- 
Helping to assertively morph transparent cutting-edge best-of-breed innovative 
paradigms as part of the IT team of the year, '09 and '08



This email is sent for and on behalf of Halliwells LLP.

Halliwells LLP is a limited liability partnership registered in England and 
Wales under registered number OC307980 whose registered office address is at 
Halliwells LLP, 3 Hardman Square, Spinningfields, Manchester, M3 3EB.  A list 
of members is available for inspection at the registered office together with a 
list of those non members who are referred to as partners.  We use the word 
?partner? to refer to a member of the LLP, or an employee or consultant with 
equivalent standing and qualifications. Regulated by the Solicitors Regulation 
Authority.

CONFIDENTIALITY

This email is intended only for the use of the addressee named above and may be 
confidential or legally privileged.  If you are not the addressee you must not 
read it and must not use any information contained in nor copy it nor inform 
any person other than Halliwells LLP or the addressee of its existence or 
contents.  If you have received this email in error please delete it and notify 
Halliwells LLP IT Department on 0870 365 2500.

For more information about Halliwells LLP visit www.halliwells.com.

Re: [flexcoders] FileReference.load()

2009-07-27 Thread Richard Rodseth
Yes, I suppose that could work, though it would complicate the build and the
test matrix.

On Mon, Jul 27, 2009 at 5:31 AM, Tom Chiverton tom.chiver...@halliwells.com
 wrote:



 On Thursday 23 Jul 2009, Richard Rodseth wrote:
  Thanks for the explanation. More or less what I expected until Gordon
 made
  his suggestion.
  I think I have approval to require 10, but I'd still be interested to
 know
  if Gordon concurs with your conclusion.

 Could you just alter the JavaScript wrapper to use the v9 or v10 version of

 your app, depending on what is installed in the client ?
 You can still compile both from the same source code, it seems, and have
 different code paths taken depending if the the code is running on v9 or
 v10
 player.

 --
 Helping to assertively morph transparent cutting-edge best-of-breed
 innovative
 paradigms as part of the IT team of the year, '09 and '08

 

 This email is sent for and on behalf of Halliwells LLP.

 Halliwells LLP is a limited liability partnership registered in England and
 Wales under registered number OC307980 whose registered office address is at
 Halliwells LLP, 3 Hardman Square, Spinningfields, Manchester, M3 3EB. A list
 of members is available for inspection at the registered office together
 with a list of those non members who are referred to as partners. We use the
 word ?partner? to refer to a member of the LLP, or an employee or consultant
 with equivalent standing and qualifications. Regulated by the Solicitors
 Regulation Authority.

 CONFIDENTIALITY

 This email is intended only for the use of the addressee named above and
 may be confidential or legally privileged. If you are not the addressee you
 must not read it and must not use any information contained in nor copy it
 nor inform any person other than Halliwells LLP or the addressee of its
 existence or contents. If you have received this email in error please
 delete it and notify Halliwells LLP IT Department on 0870 365 2500.

 For more information about Halliwells LLP visit www.Halliwells.com.
  



Re: [flexcoders] FileReference.load()

2009-07-23 Thread Richard Rodseth
Nice! But it's not working for me yet. The in expression doesn't succeed.
I'll keep digging through the reflection docs, but if you have any
refinements, please pass them along.

On Wed, Jul 22, 2009 at 6:33 PM, Gordon Smith gosm...@adobe.com wrote:



  Try this:



 if (load in fileReference)

 fileReference[load]();



 That should compile against the Player 9 version of playerglobal.swc, but,
 in Player 10, detect that the method exists and call it by name.



 Gordon Smith

 Adobe Flex SDK Team



 *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On
 Behalf Of *Richard Rodseth
 *Sent:* Wednesday, July 22, 2009 6:12 PM
 *To:* flexcoders@yahoogroups.com
 *Subject:* [flexcoders] FileReference.load()





 I was hoping to provide an optional feature that requires reading a local
 file if Player 10 is available, without requiring 10 for the whole
 application.

 But it appears that I can't compile code that uses FileReference.load()
 without setting the target player in FlexBuilder.

 Anyone dealt with this situation?

   



Re: [flexcoders] FileReference.load()

2009-07-23 Thread Richard Rodseth
Unfortunately,

if (load in fileReference)

does not succeed unless I specify Player 10 in the build settings.

On Thu, Jul 23, 2009 at 9:56 AM, Richard Rodseth rrods...@gmail.com wrote:

 Nice! But it's not working for me yet. The in expression doesn't succeed.
 I'll keep digging through the reflection docs, but if you have any
 refinements, please pass them along.


 On Wed, Jul 22, 2009 at 6:33 PM, Gordon Smith gosm...@adobe.com wrote:



  Try this:



 if (load in fileReference)

 fileReference[load]();



 That should compile against the Player 9 version of playerglobal.swc, but,
 in Player 10, detect that the method exists and call it by name.



 Gordon Smith

 Adobe Flex SDK Team



 *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On
 Behalf Of *Richard Rodseth
 *Sent:* Wednesday, July 22, 2009 6:12 PM
 *To:* flexcoders@yahoogroups.com
 *Subject:* [flexcoders] FileReference.load()





 I was hoping to provide an optional feature that requires reading a local
 file if Player 10 is available, without requiring 10 for the whole
 application.

 But it appears that I can't compile code that uses FileReference.load()
 without setting the target player in FlexBuilder.

 Anyone dealt with this situation?

   





Re: [flexcoders] FileReference.load()

2009-07-23 Thread Beau Scott
Err... extra paren in there.

if(fileReference.hasOwnProperty(load))
   fileReference[load]();


Beau


On Thu, Jul 23, 2009 at 12:23 PM, Beau Scott beau.sc...@gmail.com wrote:

 if(fileReference.hasOwnProperty('load'))
fileReference([load']();

 Beau




 On Thu, Jul 23, 2009 at 12:18 PM, Richard Rodseth rrods...@gmail.comwrote:



 Unfortunately,

 if (load in fileReference)

 does not succeed unless I specify Player 10 in the build settings.

 On Thu, Jul 23, 2009 at 9:56 AM, Richard Rodseth rrods...@gmail.comwrote:

 Nice! But it's not working for me yet. The in expression doesn't
 succeed. I'll keep digging through the reflection docs, but if you have any
 refinements, please pass them along.


 On Wed, Jul 22, 2009 at 6:33 PM, Gordon Smith gosm...@adobe.com wrote:



  Try this:



 if (load in fileReference)

 fileReference[load]();



 That should compile against the Player 9 version of playerglobal.swc,
 but, in Player 10, detect that the method exists and call it by name.



 Gordon Smith

 Adobe Flex SDK Team



 *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com]
 *On Behalf Of *Richard Rodseth
 *Sent:* Wednesday, July 22, 2009 6:12 PM
 *To:* flexcoders@yahoogroups.com
 *Subject:* [flexcoders] FileReference.load()





 I was hoping to provide an optional feature that requires reading a
 local file if Player 10 is available, without requiring 10 for the whole
 application.

 But it appears that I can't compile code that uses FileReference.load()
 without setting the target player in FlexBuilder.

 Anyone dealt with this situation?



  




 --
 Beau D. Scott
 Software Engineer




-- 
Beau D. Scott
Software Engineer


Re: [flexcoders] FileReference.load()

2009-07-23 Thread Beau Scott
if(fileReference.hasOwnProperty('load'))
   fileReference([load']();

Beau



On Thu, Jul 23, 2009 at 12:18 PM, Richard Rodseth rrods...@gmail.comwrote:



 Unfortunately,

 if (load in fileReference)

 does not succeed unless I specify Player 10 in the build settings.

 On Thu, Jul 23, 2009 at 9:56 AM, Richard Rodseth rrods...@gmail.comwrote:

 Nice! But it's not working for me yet. The in expression doesn't
 succeed. I'll keep digging through the reflection docs, but if you have any
 refinements, please pass them along.


 On Wed, Jul 22, 2009 at 6:33 PM, Gordon Smith gosm...@adobe.com wrote:



  Try this:



 if (load in fileReference)

 fileReference[load]();



 That should compile against the Player 9 version of playerglobal.swc,
 but, in Player 10, detect that the method exists and call it by name.



 Gordon Smith

 Adobe Flex SDK Team



 *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On
 Behalf Of *Richard Rodseth
 *Sent:* Wednesday, July 22, 2009 6:12 PM
 *To:* flexcoders@yahoogroups.com
 *Subject:* [flexcoders] FileReference.load()





 I was hoping to provide an optional feature that requires reading a local
 file if Player 10 is available, without requiring 10 for the whole
 application.

 But it appears that I can't compile code that uses FileReference.load()
 without setting the target player in FlexBuilder.

 Anyone dealt with this situation?



  




-- 
Beau D. Scott
Software Engineer


Re: [flexcoders] FileReference.load()

2009-07-23 Thread Richard Rodseth
Nope, I've tried that too. Has that worked for you, or are you guessing?

On Thu, Jul 23, 2009 at 11:23 AM, Beau Scott beau.sc...@gmail.com wrote:



 if(fileReference.hasOwnProperty('load'))
fileReference([load']();

 Beau




 On Thu, Jul 23, 2009 at 12:18 PM, Richard Rodseth rrods...@gmail.comwrote:



 Unfortunately,

 if (load in fileReference)

 does not succeed unless I specify Player 10 in the build settings.

 On Thu, Jul 23, 2009 at 9:56 AM, Richard Rodseth rrods...@gmail.comwrote:

 Nice! But it's not working for me yet. The in expression doesn't
 succeed. I'll keep digging through the reflection docs, but if you have any
 refinements, please pass them along.


 On Wed, Jul 22, 2009 at 6:33 PM, Gordon Smith gosm...@adobe.com wrote:



  Try this:



 if (load in fileReference)

 fileReference[load]();



 That should compile against the Player 9 version of playerglobal.swc,
 but, in Player 10, detect that the method exists and call it by name.



 Gordon Smith

 Adobe Flex SDK Team



 *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com]
 *On Behalf Of *Richard Rodseth
 *Sent:* Wednesday, July 22, 2009 6:12 PM
 *To:* flexcoders@yahoogroups.com
 *Subject:* [flexcoders] FileReference.load()





 I was hoping to provide an optional feature that requires reading a
 local file if Player 10 is available, without requiring 10 for the whole
 application.

 But it appears that I can't compile code that uses FileReference.load()
 without setting the target player in FlexBuilder.

 Anyone dealt with this situation?






 --
 Beau D. Scott
 Software Engineer
  



Re: [flexcoders] FileReference.load()

2009-07-23 Thread Beau Scott
Works fine for me.I just tried it in both 9.0.124 and 10 players:

?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute
xmlns:local=*
mx:Script
![CDATA[
import mx.controls.Label;
import mx.controls.Alert;
override protected function childrenCreated():void
{
if(this.hasOwnProperty(foo))
{
this[foo]();
}
}

public function foo():void
{
var lbl:Label = new Label();
lbl.text = It worked;
addChild(lbl);
}
]]
/mx:Script
/mx:Application

Beau



On Thu, Jul 23, 2009 at 12:33 PM, Richard Rodseth rrods...@gmail.comwrote:



 Nope, I've tried that too. Has that worked for you, or are you guessing?

 On Thu, Jul 23, 2009 at 11:23 AM, Beau Scott beau.sc...@gmail.com wrote:



 if(fileReference.hasOwnProperty('load'))
fileReference([load']();

 Beau




 On Thu, Jul 23, 2009 at 12:18 PM, Richard Rodseth rrods...@gmail.comwrote:



 Unfortunately,

 if (load in fileReference)

 does not succeed unless I specify Player 10 in the build settings.

 On Thu, Jul 23, 2009 at 9:56 AM, Richard Rodseth rrods...@gmail.comwrote:

 Nice! But it's not working for me yet. The in expression doesn't
 succeed. I'll keep digging through the reflection docs, but if you have any
 refinements, please pass them along.


 On Wed, Jul 22, 2009 at 6:33 PM, Gordon Smith gosm...@adobe.comwrote:



  Try this:



 if (load in fileReference)

 fileReference[load]();



 That should compile against the Player 9 version of playerglobal.swc,
 but, in Player 10, detect that the method exists and call it by name.



 Gordon Smith

 Adobe Flex SDK Team



 *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com]
 *On Behalf Of *Richard Rodseth
 *Sent:* Wednesday, July 22, 2009 6:12 PM
 *To:* flexcoders@yahoogroups.com
 *Subject:* [flexcoders] FileReference.load()





 I was hoping to provide an optional feature that requires reading a
 local file if Player 10 is available, without requiring 10 for the whole
 application.

 But it appears that I can't compile code that uses FileReference.load()
 without setting the target player in FlexBuilder.

 Anyone dealt with this situation?






 --
 Beau D. Scott
 Software Engineer


  




-- 
Beau D. Scott
Software Engineer


Re: [flexcoders] FileReference.load()

2009-07-23 Thread Richard Rodseth
But it's the flash.netFileReference class that's in play:

private var fileReference:FileReference = new FileReference();

private function onAddFile(event:Event):void {
var filter:FileFilter = new FileFilter(Text, *.xml);
fileReference.browse([filter]);
fileReference.addEventListener(Event.SELECT, onFileSelect);
fileReference.addEventListener(Event.COMPLETE, onFileComplete);
}

private function onFileSelect(event:Event):void
  {
  if (load in this.fileReference) {
  fileReference[load]();
  }
  }

  private function onFileComplete(event:Event):void
  {
  var property:String = data;
  myText.text =
fileReference[data].readUTFBytes(fileReference[data].length);
  }


On Thu, Jul 23, 2009 at 11:51 AM, Beau Scott beau.sc...@gmail.com wrote:



 Works fine for me.I just tried it in both 9.0.124 and 10 players:

 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
 layout=absolute xmlns:local=*
 mx:Script
 ![CDATA[
 import mx.controls.Label;
 import mx.controls.Alert;
 override protected function childrenCreated():void
 {
 if(this.hasOwnProperty(foo))
 {
 this[foo]();
 }
 }

 public function foo():void
 {
 var lbl:Label = new Label();
 lbl.text = It worked;
 addChild(lbl);
 }
 ]]
 /mx:Script
 /mx:Application

 Beau




 On Thu, Jul 23, 2009 at 12:33 PM, Richard Rodseth rrods...@gmail.comwrote:



 Nope, I've tried that too. Has that worked for you, or are you guessing?

 On Thu, Jul 23, 2009 at 11:23 AM, Beau Scott beau.sc...@gmail.comwrote:



 if(fileReference.hasOwnProperty('load'))
fileReference([load']();

 Beau




 On Thu, Jul 23, 2009 at 12:18 PM, Richard Rodseth rrods...@gmail.comwrote:



 Unfortunately,

 if (load in fileReference)

 does not succeed unless I specify Player 10 in the build settings.

 On Thu, Jul 23, 2009 at 9:56 AM, Richard Rodseth rrods...@gmail.comwrote:

 Nice! But it's not working for me yet. The in expression doesn't
 succeed. I'll keep digging through the reflection docs, but if you have 
 any
 refinements, please pass them along.


 On Wed, Jul 22, 2009 at 6:33 PM, Gordon Smith gosm...@adobe.comwrote:



  Try this:



 if (load in fileReference)

 fileReference[load]();



 That should compile against the Player 9 version of playerglobal.swc,
 but, in Player 10, detect that the method exists and call it by name.



 Gordon Smith

 Adobe Flex SDK Team



 *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com]
 *On Behalf Of *Richard Rodseth
 *Sent:* Wednesday, July 22, 2009 6:12 PM
 *To:* flexcoders@yahoogroups.com
 *Subject:* [flexcoders] FileReference.load()





 I was hoping to provide an optional feature that requires reading a
 local file if Player 10 is available, without requiring 10 for the whole
 application.

 But it appears that I can't compile code that uses
 FileReference.load() without setting the target player in FlexBuilder.

 Anyone dealt with this situation?






 --
 Beau D. Scott
 Software Engineer





 --
 Beau D. Scott
 Software Engineer
  



Re: [flexcoders] FileReference.load()

2009-07-23 Thread Beau Scott
Ah, I see what you're saying now. The answer is you're not going to be able
to do it unless you use 10, because the compiler looks at the compatible
player version and includes version-specific swcs at compile time (Flex
Builder 3 Plug-in\sdks\3.2.0\frameworks\libs\player\9\playerglobal.swc vs
Flex Builder 3
Plug-in\sdks\3.2.0\frameworks\libs\player\10\playerglobal.swc). Therefore
load will never be available no matter what player is playing it if you're
specifiying 9 as the lowest compatible version. These libs don't exist in
the player itself, it's supplied by the swf.

Beau





On Thu, Jul 23, 2009 at 12:57 PM, Richard Rodseth rrods...@gmail.comwrote:



 But it's the flash.netFileReference class that's in play:

 private var fileReference:FileReference = new FileReference();

 private function onAddFile(event:Event):void {
 var filter:FileFilter = new FileFilter(Text, *.xml);
 fileReference.browse([filter]);
 fileReference.addEventListener(Event.SELECT, onFileSelect);
 fileReference.addEventListener(Event.COMPLETE, onFileComplete);
 }

 private function onFileSelect(event:Event):void
   {
   if (load in this.fileReference) {
   fileReference[load]();
   }
   }

   private function onFileComplete(event:Event):void
   {
   var property:String = data;
   myText.text =
 fileReference[data].readUTFBytes(fileReference[data].length);

   }


 On Thu, Jul 23, 2009 at 11:51 AM, Beau Scott beau.sc...@gmail.com wrote:



 Works fine for me.I just tried it in both 9.0.124 and 10 players:

 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
 layout=absolute xmlns:local=*
 mx:Script
 ![CDATA[
 import mx.controls.Label;
 import mx.controls.Alert;
 override protected function childrenCreated():void
 {
 if(this.hasOwnProperty(foo))
 {
 this[foo]();
 }
 }

 public function foo():void
 {
 var lbl:Label = new Label();
 lbl.text = It worked;
 addChild(lbl);
 }
 ]]
 /mx:Script
 /mx:Application

 Beau




 On Thu, Jul 23, 2009 at 12:33 PM, Richard Rodseth rrods...@gmail.comwrote:



 Nope, I've tried that too. Has that worked for you, or are you guessing?

 On Thu, Jul 23, 2009 at 11:23 AM, Beau Scott beau.sc...@gmail.comwrote:



 if(fileReference.hasOwnProperty('load'))
fileReference([load']();

 Beau




 On Thu, Jul 23, 2009 at 12:18 PM, Richard Rodseth 
 rrods...@gmail.comwrote:



 Unfortunately,

 if (load in fileReference)

 does not succeed unless I specify Player 10 in the build settings.

 On Thu, Jul 23, 2009 at 9:56 AM, Richard Rodseth 
 rrods...@gmail.comwrote:

 Nice! But it's not working for me yet. The in expression doesn't
 succeed. I'll keep digging through the reflection docs, but if you have 
 any
 refinements, please pass them along.


 On Wed, Jul 22, 2009 at 6:33 PM, Gordon Smith gosm...@adobe.comwrote:



  Try this:



 if (load in fileReference)

 fileReference[load]();



 That should compile against the Player 9 version of playerglobal.swc,
 but, in Player 10, detect that the method exists and call it by name.



 Gordon Smith

 Adobe Flex SDK Team



 *From:* flexcoders@yahoogroups.com [mailto:
 flexcod...@yahoogroups.com] *On Behalf Of *Richard Rodseth
 *Sent:* Wednesday, July 22, 2009 6:12 PM
 *To:* flexcoders@yahoogroups.com
 *Subject:* [flexcoders] FileReference.load()





 I was hoping to provide an optional feature that requires reading a
 local file if Player 10 is available, without requiring 10 for the whole
 application.

 But it appears that I can't compile code that uses
 FileReference.load() without setting the target player in FlexBuilder.

 Anyone dealt with this situation?






 --
 Beau D. Scott
 Software Engineer





 --
 Beau D. Scott
 Software Engineer


  




-- 
Beau D. Scott
Software Engineer


Re: [flexcoders] FileReference.load()

2009-07-23 Thread Richard Rodseth
Thanks for the explanation. More or less what I expected until Gordon made
his suggestion.
I think I have approval to require 10, but I'd still be interested to know
if Gordon concurs with your conclusion.

On Thu, Jul 23, 2009 at 12:19 PM, Beau Scott beau.sc...@gmail.com wrote:



 Ah, I see what you're saying now. The answer is you're not going to be able
 to do it unless you use 10, because the compiler looks at the compatible
 player version and includes version-specific swcs at compile time (Flex
 Builder 3 Plug-in\sdks\3.2.0\frameworks\libs\player\9\playerglobal.swc vs
 Flex Builder 3
 Plug-in\sdks\3.2.0\frameworks\libs\player\10\playerglobal.swc). Therefore
 load will never be available no matter what player is playing it if you're
 specifiying 9 as the lowest compatible version. These libs don't exist in
 the player itself, it's supplied by the swf.

 Beau






 On Thu, Jul 23, 2009 at 12:57 PM, Richard Rodseth rrods...@gmail.comwrote:



 But it's the flash.netFileReference class that's in play:

 private var fileReference:FileReference = new FileReference();

 private function onAddFile(event:Event):void {
 var filter:FileFilter = new FileFilter(Text, *.xml);
 fileReference.browse([filter]);
 fileReference.addEventListener(Event.SELECT, onFileSelect);
 fileReference.addEventListener(Event.COMPLETE,
 onFileComplete);
 }

 private function onFileSelect(event:Event):void
   {
   if (load in this.fileReference) {
   fileReference[load]();
   }
   }

   private function onFileComplete(event:Event):void
   {
   var property:String = data;
   myText.text =
 fileReference[data].readUTFBytes(fileReference[data].length);

   }


 On Thu, Jul 23, 2009 at 11:51 AM, Beau Scott beau.sc...@gmail.comwrote:



 Works fine for me.I just tried it in both 9.0.124 and 10 players:

 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
 layout=absolute xmlns:local=*
 mx:Script
 ![CDATA[
 import mx.controls.Label;
 import mx.controls.Alert;
 override protected function childrenCreated():void
 {
 if(this.hasOwnProperty(foo))
 {
 this[foo]();
 }
 }

 public function foo():void
 {
 var lbl:Label = new Label();
 lbl.text = It worked;
 addChild(lbl);
 }
 ]]
 /mx:Script
 /mx:Application

 Beau




 On Thu, Jul 23, 2009 at 12:33 PM, Richard Rodseth rrods...@gmail.comwrote:



 Nope, I've tried that too. Has that worked for you, or are you guessing?

 On Thu, Jul 23, 2009 at 11:23 AM, Beau Scott beau.sc...@gmail.comwrote:



 if(fileReference.hasOwnProperty('load'))
fileReference([load']();

 Beau




 On Thu, Jul 23, 2009 at 12:18 PM, Richard Rodseth 
 rrods...@gmail.comwrote:



 Unfortunately,

 if (load in fileReference)

 does not succeed unless I specify Player 10 in the build settings.

 On Thu, Jul 23, 2009 at 9:56 AM, Richard Rodseth 
 rrods...@gmail.comwrote:

 Nice! But it's not working for me yet. The in expression doesn't
 succeed. I'll keep digging through the reflection docs, but if you have 
 any
 refinements, please pass them along.


 On Wed, Jul 22, 2009 at 6:33 PM, Gordon Smith gosm...@adobe.comwrote:



  Try this:



 if (load in fileReference)

 fileReference[load]();



 That should compile against the Player 9 version of
 playerglobal.swc, but, in Player 10, detect that the method exists and 
 call
 it by name.



 Gordon Smith

 Adobe Flex SDK Team



 *From:* flexcoders@yahoogroups.com [mailto:
 flexcod...@yahoogroups.com] *On Behalf Of *Richard Rodseth
 *Sent:* Wednesday, July 22, 2009 6:12 PM
 *To:* flexcoders@yahoogroups.com
 *Subject:* [flexcoders] FileReference.load()





 I was hoping to provide an optional feature that requires reading a
 local file if Player 10 is available, without requiring 10 for the 
 whole
 application.

 But it appears that I can't compile code that uses
 FileReference.load() without setting the target player in FlexBuilder.

 Anyone dealt with this situation?






 --
 Beau D. Scott
 Software Engineer





 --
 Beau D. Scott
 Software Engineer





 --
 Beau D. Scott
 Software Engineer
  



RE: [flexcoders] FileReference.load()

2009-07-23 Thread Gordon Smith
Interesting! If it's true I think it has to do with there being a difference in 
major version number, and that number getting written into the SWF header. It 
may well be that Player 10 APIs are made invisible to a SWF whose header says 
it is for Player 9. I think this may be how the addition of the z property to 
DisplayObject was added without disruption to SWFs that defined their own 
subclasses with a z property.

I'm pretty sure that it doesn't apply for minor version changes. For example if 
you compile with a playerglobal.swc for 10.0, I'm almost certain that you can 
use code like

if (doSomething in obj)
obj[doSomething]();

to look for and call a doSomething() method that has been added for 10.1. But 
that's doesn't help you.

Gordon Smith
Adobe Flex SDK Team

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf 
Of Richard Rodseth
Sent: Thursday, July 23, 2009 3:42 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] FileReference.load()



Thanks for the explanation. More or less what I expected until Gordon made his 
suggestion.
I think I have approval to require 10, but I'd still be interested to know if 
Gordon concurs with your conclusion.
On Thu, Jul 23, 2009 at 12:19 PM, Beau Scott 
beau.sc...@gmail.commailto:beau.sc...@gmail.com wrote:


Ah, I see what you're saying now. The answer is you're not going to be able to 
do it unless you use 10, because the compiler looks at the compatible player 
version and includes version-specific swcs at compile time (Flex Builder 3 
Plug-in\sdks\3.2.0\frameworks\libs\player\9\playerglobal.swc vs Flex Builder 3 
Plug-in\sdks\3.2.0\frameworks\libs\player\10\playerglobal.swc). Therefore 
load will never be available no matter what player is playing it if you're 
specifiying 9 as the lowest compatible version. These libs don't exist in the 
player itself, it's supplied by the swf.

Beau





On Thu, Jul 23, 2009 at 12:57 PM, Richard Rodseth 
rrods...@gmail.commailto:rrods...@gmail.com wrote:


But it's the flash.netFileReference class that's in play:

private var fileReference:FileReference = new FileReference();

private function onAddFile(event:Event):void {
var filter:FileFilter = new FileFilter(Text, *.xml);
fileReference.browse([filter]);
fileReference.addEventListener(Event.SELECT, onFileSelect);
fileReference.addEventListener(Event.COMPLETE, onFileComplete);
}

private function onFileSelect(event:Event):void
  {
  if (load in this.fileReference) {
  fileReference[load]();
  }
  }

  private function onFileComplete(event:Event):void
  {
  var property:String = data;
  myText.text = 
fileReference[data].readUTFBytes(fileReference[data].length);

  }

On Thu, Jul 23, 2009 at 11:51 AM, Beau Scott 
beau.sc...@gmail.commailto:beau.sc...@gmail.com wrote:


Works fine for me.I just tried it in both 9.0.124 and 10 players:

?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute 
xmlns:local=*
mx:Script
![CDATA[
import mx.controls.Label;
import mx.controls.Alert;
override protected function childrenCreated():void
{
if(this.hasOwnProperty(foo))
{
this[foo]();
}
}

public function foo():void
{
var lbl:Label = new Label();
lbl.text = It worked;
addChild(lbl);
}
]]
/mx:Script
/mx:Application

Beau



On Thu, Jul 23, 2009 at 12:33 PM, Richard Rodseth 
rrods...@gmail.commailto:rrods...@gmail.com wrote:


Nope, I've tried that too. Has that worked for you, or are you guessing?
On Thu, Jul 23, 2009 at 11:23 AM, Beau Scott 
beau.sc...@gmail.commailto:beau.sc...@gmail.com wrote:


if(fileReference.hasOwnProperty('load'))
   fileReference([load']();

Beau



On Thu, Jul 23, 2009 at 12:18 PM, Richard Rodseth 
rrods...@gmail.commailto:rrods...@gmail.com wrote:


Unfortunately,

if (load in fileReference)

does not succeed unless I specify Player 10 in the build settings.
On Thu, Jul 23, 2009 at 9:56 AM, Richard Rodseth 
rrods...@gmail.commailto:rrods...@gmail.com wrote:
Nice! But it's not working for me yet. The in expression doesn't succeed. 
I'll keep digging through the reflection docs, but if you have any refinements, 
please pass them along.

On Wed, Jul 22, 2009 at 6:33 PM, Gordon Smith 
gosm...@adobe.commailto:gosm...@adobe.com wrote:


Try this:



if (load in fileReference)

fileReference[load]();



That should compile against the Player 9 version of playerglobal.swc, but, in 
Player 10, detect that the method exists and call it by name.



Gordon Smith

Adobe Flex SDK Team



From: flexcoders@yahoogroups.commailto:flexcoders@yahoogroups.com

RE: [flexcoders] FileReference.load()

2009-07-22 Thread Gordon Smith
Try this:

if (load in fileReference)
fileReference[load]();

That should compile against the Player 9 version of playerglobal.swc, but, in 
Player 10, detect that the method exists and call it by name.

Gordon Smith
Adobe Flex SDK Team

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf 
Of Richard Rodseth
Sent: Wednesday, July 22, 2009 6:12 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] FileReference.load()



I was hoping to provide an optional feature that requires reading a local file 
if Player 10 is available, without requiring 10 for the whole application.

But it appears that I can't compile code that uses FileReference.load() without 
setting the target player in FlexBuilder.

Anyone dealt with this situation?