I did some more testing, and have some questions on the logic of the
code in setResource. According to the docs
(http://www.openlaszlo.org/lps4.8/docs/reference/) the src attribute
of a resource tag is an URL. The value of the src tag will be used to
call setResource on a view, when I assign a resource to a view, as in
this example:

<canvas height="70">
  <resource name="logo" src="../images/logo.png"/>
  <view resource="logo"/>
</canvas>

At runtime, you can set a views resource by using
someView.setAttribute("source", resourceURL), or using
someView.setAttribute("resource", resourceURL). In that case,
LzSprite#setResource method is called. Actually this is a bit
confusing, since you can't use a URL within a resource tag's @src:

  <resource name="mountainRsc" src="http:resources/images/wetterstein.jpg" />

This will trigger a compiler error with the error message "unknown
protocol: http". If setAttribute("resource", http/https/app URL) works
at runtime, why even provide a setSource method?

I attached a testcase for you with comments to the JIRA issue as well.


On Fri, Sep 10, 2010 at 1:14 AM, Raju Bitter
<[email protected]> wrote:
> Yes, based on my testing. Tested with image files and MP3 files for
> audio playback.
>
> On Thu, Sep 9, 2010 at 11:44 PM, Henry Minsky <[email protected]> wrote:
>> Raju, I'm going to file a JIRA request to track this change, is this the
>> only change you need to the LFC
>> to support AIR resources?
>>
>>
>> --- WEB-INF/lps/lfc/kernel/swf9/LzSprite.as    (revision 17458)
>> +++ WEB-INF/lps/lfc/kernel/swf9/LzSprite.as    (working copy)
>> @@ -363,7 +363,8 @@
>>      */
>>      public function setResource (r:String):void {
>>          if (this.resource == r) return;
>> -        if (r.indexOf('http:') == 0 || r.indexOf('https:') == 0) {
>> +        if (r.indexOf('http:') == 0 || r.indexOf('https:') == 0 ||
>> r.indexOf('app:') == 0) {
>> +            //        if (r.indexOf('http:') == 0 || r.indexOf('https:') ==
>> 0) {
>>              this.setSource( r );
>>              return;
>>          }
>>
>>
>> --
>> Henry Minsky
>> Software Architect
>> [email protected]
>>
>>
>>
>

Reply via email to