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.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.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.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.com>wrote:
>>>>
>>>>>
>>>>>
>>>>> if(fileReference.hasOwnProperty('load'))
>>>>>    fileReference([load']();
>>>>>
>>>>> Beau
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Thu, Jul 23, 2009 at 12:18 PM, Richard Rodseth 
>>>>> <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.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?
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Beau D. Scott
>>>>> Software Engineer
>>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> Beau D. Scott
>>> Software Engineer
>>>
>>
>>
>
>
> --
> Beau D. Scott
> Software Engineer
>  
>

Reply via email to