[flexcoders] app:/file.swf not being loaded into HTMLLoader (AIR)

2011-12-09 Thread mattgarland2000
It's not showing up.

I have a simple html file in src directory (preview.html)

!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN 
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;
html xmlns=http://www.w3.org/1999/xhtml; lang=en xml:lang=en
body
div id=flashContent height=675 width=1010
object type='application/x-shockwave-flash' width='100%' height='100%' 
id=flash 
param name=movie value=app:/main.swf/
param name=wmode value=opaque/
/object
/body
/div
/html

It is embedded as a string and loaded by an htmlLoader:

[Embed(source=preview.html, 
mimeType=application/octet-stream)]
private var previewStr:Class;

var html:HTMLLoader = new HTMLLoader();
var bytes:ByteArray = new previewStr();
var preview:String = 
bytes.readUTFBytes(bytes.length)
html.loadString(preview);
html.height=675;
html.width=1010;
var wrapper:UIComponent=new UIComponent();
wrapper.addChild(html);
addElement(wrapper);

The window appears...but without the swf. Does anyone know why?



[flexcoders] Re: app:/file.swf not being loaded into HTMLLoader (AIR)

2011-12-09 Thread mattgarland2000
I had to wait until the load before I added it to the display list...:)

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

 It's not showing up.
 
 I have a simple html file in src directory (preview.html)
 
 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN 
 http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;
 html xmlns=http://www.w3.org/1999/xhtml; lang=en xml:lang=en
   body
   div id=flashContent height=675 width=1010
   object type='application/x-shockwave-flash' width='100%' height='100%' 
 id=flash 
   param name=movie value=app:/main.swf/
   param name=wmode value=opaque/
   /object
   /body
   /div
 /html
 
 It is embedded as a string and loaded by an htmlLoader:
 
   [Embed(source=preview.html, 
 mimeType=application/octet-stream)]
   private var previewStr:Class;
 
 var html:HTMLLoader = new HTMLLoader();
   var bytes:ByteArray = new previewStr();
   var preview:String = 
 bytes.readUTFBytes(bytes.length)
   html.loadString(preview);
   html.height=675;
   html.width=1010;
   var wrapper:UIComponent=new UIComponent();
   wrapper.addChild(html);
   addElement(wrapper);
 
 The window appears...but without the swf. Does anyone know why?





[flexcoders] Best way to load Flash swfs from a network drive into an AIR app...

2011-12-08 Thread mattgarland2000
...given this situation:

The Flex/AIR app is an in-house e-learning course editor. It handles course 
preview by loading a course swf and injecting it with xml. The course swf is 
AS3 and it operates during preview like it does on the web--it gets an xml 
manifest, then loads other swfs (smart skins), and other material (images, 
etc). 

Ideally, all the swfs and assets would exist outside the AIR package in a 
network drive so that they could be updated by editors and designers who simply 
add skins and pictures to the network drive, then open up the app and browse 
the file system to pick skins and images and have their paths added to the xml. 
Ideally, too, that network drive would be on a development server, so the main 
course swf could load swfs from the same place.

Of course this could cause security problems, and indeed, the prototype worked 
fine while testing in Flash Builder but failed to load the main swf after a 
release build.  So I scurried around the web and found a bunch of different, 
partial solutions to the problem. I'm not sure which fits the situation best:

1. Clear all global references from the AS3 course framework and components: no 
reference to Stage, SoundMixer, etc. If I could do this--it is not clear at 
this point whether this would be possible--would that get rid of security 
violations? And if all course-editor cross-scripting were banished, would 
editor--course cross-scripting (the injecting of the data) still be allowed? 

2. Have the AIR app load the course swf via Loader.loadBytes(). But I am not 
sure that if course swf would then ALSO have to load all its skins with 
loadBytes(), too. (I really don't want to touch the course code for the sake of 
the editor.) Also I am not sure if this trick works for swfs loaded from a 
network drive (part of the file system) rather than the AIR app's 
applicationStorage. 

3. Sign the main course swfs and include their names/paths in a signature xml. 
I am unclear how to sign a regular AS3 swf (not a Flex module) and whether 
signing them would solve my problem or just add an extra layer of security that 
I do not need. 

4. Create a sandbox bridge between the AIR app and the main course skin. (This 
would get rid of the security error if the parent--child cross-scripting is 
giving rise to the security error). 

5. Create an HTMLLoader and load the main course swf into that. But I have 
never worked with HTMLLoader and I'm not sure if I can specify a swf url, embed 
it in the page, load the page, then inject data into the swf. 

I'm amazed at how complicated this is, and unsure where to start. And advice?





[flexcoders] Re: excluding symbols from sub swf

2010-06-05 Thread mattgarland2000
Thanks Alex,


Is there a way to use compiler options in CS5--or Flash Builder--with a fla? 
That sounds awesome. I'm in CS4/Flex Builder 3 now. 

Are other people using this? I googled this I don't see any examples of it. It 
would be great to:

 -externs com.site.Dog

whether using the Flash Builder, Flash, or the new jsfl API.

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

 -externs option
 
 
 On 6/4/10 6:09 PM, mattgarland2000 al...@... wrote:
 
 
 
 
 
 
 In my main swf, I have a (CS4) library item with the class of Dog. It's just 
 a movie clip with a picture of a dog inside it.
 
 In the sub swf, there is a also a dog on the stage.
 
 It's necessary that the item in the sub swf be in the library or components 
 panel, because my designer likes dogs. He likes to place them on the stage, 
 rotate them, and play with them all day.
 
 It's a big Dog. And there are many sub swfs. Is there a way to exclude Dog 
 from the sub swfs?
 
 Runtime Shared Libraries is not an option--too flaky. And runtime loading of 
 assets is not an option either, unless it can be made compatible with WYSIWYG.
 
 I tried this:
 
 1. Creating a dog.swc component, using it, and then putting it in the 
 external library path of the sub swf.
 2. Putting the dog swc in the folder with main.fla.
 These did not work. The big Dog remained either way.
 
 I looked into this:
 Using -load-externs and -link-report compiler options for an actionscript 
 project. But there is not link report for .flas, and no compiler options 
 either, and jsfl does not seem to provide workarounds.
 
 Is it even possible (without using Runtime Shared Libraries) to exclude 
 symbols from compiled flas?
 
 Thanks!
 
 Matt
 
 
 
 
 
 
 --
 Alex Harui
 Flex SDK Team
 Adobe System, Inc.
 http://blogs.adobe.com/aharui





[flexcoders] excluding symbols from sub swf

2010-06-04 Thread mattgarland2000
In my main swf, I have a (CS4) library item with the class of Dog. It's just a 
movie clip with a picture of a dog inside it. 

In the sub swf, there is a also a dog on the stage.

It's necessary that the item in the sub swf be in the library or components 
panel, because my designer likes dogs. He likes to place them on the stage, 
rotate them, and play with them all day. 

It's a big Dog. And there are many sub swfs. Is there a way to exclude Dog from 
the sub swfs?

Runtime Shared Libraries is not an option--too flaky. And runtime loading of 
assets is not an option either, unless it can be made compatible with WYSIWYG. 

I tried this: 

1. Creating a dog.swc component, using it, and then putting it in the external 
library path of the sub swf. 
2. Putting the dog swc in the folder with main.fla.
These did not work. The big Dog remained either way.

I looked into this:
Using -load-externs and -link-report compiler options for an actionscript 
project. But there is not link report for .flas, and no compiler options 
either, and jsfl does not seem to provide workarounds.

Is it even possible (without using Runtime Shared Libraries) to exclude symbols 
from compiled flas? 

Thanks!

Matt









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

2009-11-24 Thread mattgarland2000


@Thomas variableRowHeight=true in the mxml.

@Alex I tried remeasuring and resizing but this didn't work right off, so I 
went with Amy's solution.

@Amy--that worked. It's always a pain to strip down to a repeater and work up 
some list functionality but it gives you so much more control, as well as less 
time-consuming mystery. 

Thanks all! Matt Garland.

--- 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] E4x finding virtual leaf nodes

2009-11-24 Thread mattgarland2000
My XML is a series of nested activities. I want to find LEAF activities, that 
is, activities without activity descendents.

Something like this: 

xml..activity.(descendents('activity').length()==0)

But of course that does not work. I've always been unsure about the scope in 
predicate filter...



[flexcoders] HorizontalList itemRenderer size does not resize on refresh

2009-11-20 Thread mattgarland2000
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: HorizontalList itemRenderer size does not resize on refresh

2009-11-20 Thread mattgarland2000


I just noticed that when the largest answer randomly ends up in the first 
position, the result is fine, so it's definitely a matter of getting the 
horizontal list to act as if variableRowHeight is set to true, and not just 
take the measurement of the first renderer and go with that. 

--- 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: HorizontalList itemRenderer size does not resize on refresh

2009-11-20 Thread mattgarland2000
Thx. Gave it a whirl, no dice. 

I need somehow to make the HorizontalList act like it had multiple image sizes, 
and measure them to get the largest rather than going with the first. 

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

 
 
 
 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 alias@ 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: first tile of tilelist does not show up

2009-11-18 Thread mattgarland2000
The column width and rowHeight are set dynamically when the components looks at 
the config details (how big is the pic, how many rows/columns should it be 
broken up into.)

Finn pointed me in the right direction--the dynamically generated images. I was 
storing all the images in the menu as an array of Bitmaps, the retrieving them 
in the renderer and assigning them to myImage source.

When 1) created a bitmap in the renderer and bound myImage.source to it, and 2) 
generated BitmapDatas in the component which are retrieved by the renderer and 
assigned to the bitmap...voila, it worked perfectly. 

Why it worked, I do not know. In the future I think I'll superstitiously tend 
toward associating Bitmaps with Images, then updating the bitmapData on the 
Bitmap, rather than resetting the Image source--at least in renderers.

Thx James and Alex.

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

 Have you set columnWIdth/rowHeight explicitly?  I wouldn't let the TileList 
 measure the renderer and decide for itself.
 
 Alex Harui
 Flex SDK Developer
 Adobe Systems Inc.http://www.adobe.com/
 Blog: http://blogs.adobe.com/aharui
 
 From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On 
 Behalf Of mattgarland2000
 Sent: Tuesday, November 17, 2009 11:13 AM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] first tile of tilelist does not show up
 
 
 
 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] first tile of tilelist does not show up

2009-11-17 Thread mattgarland2000
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 mattgarland2000


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.finni...@... 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: first tile of tilelist does not show up

2009-11-17 Thread mattgarland2000
Good call. The test image shows up. So it looks like the first image I 
dynamically create is either not available when assigned or incorrectly 
created. Looking into it...

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

 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 alias@ 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.