If you're using Flex 1.5, use the FlashPaperLoader class from Matt 
Chotin:  
http://www.cflex.net/showfiledetails.cfm?ChannelID=1&Object=File&objectID=117

If you're using Flex 2, it's a lot trickier.  Normally, you resize the 
FlashPaper.swf by using the FlashPaper API [1], and just calling the 
setSize( width, height ) method.  However, because the FlashPaper.swf 
lives inside of AVM1 and the Flex 2 loading .swf lives inside of AVM2, 
you can't just directly talk between them.

I've come up with a solution, but it's not exactly trivial.  I'll 
describe it here at a high level, and hopefully get it up on my weblog 
sometime in the near future when I have some time to package it up.

* Create a FlashPaperLoader.swf in Flash that uses a MovieClipLoader to 
load the FlashPaper document.  In this loader.swf, you need to shimmy in 
methods for communication between AVM1 and AVM2.  It's possible to use 
either LocalConnection or ExternalInterface for this, but essentially, 
the FlashPaperLoader.swf is responsible for exposing methods to AVM2 
that simply proxy the method call and parameters to the loaded 
FlashPaper.swf document.
* Instead of loading the FlashPaper.swf directly, load the 
FlashPaperLoader.swf proxy and pass it the URL of the "real" 
FlashPaper.swf to load.  Use the AVM1/AVM2 communication mechanism you 
created in the previous step to send progress information from the 
loading movie over to Flex 2, so that you can report load progress 
effectively to the user.
* When the load is complete, call the setSize on the 
FlashPaperLoader.swf, again, using the AVM1/AVM2 communication 
mechanism.  When you call setSize on FlashPaperLoader, it should proxy 
that call to the loaded FlashPaper document.
* Use the "resize" event in Flex 2 to make setSize calls, so that 
resizes the browser or container sets the correct FlashPaper size.

When all is said and done, you end up with the desired behavior of 
loading a FlashPaper document, having it fill the available area, and 
having the correct scale.  Again, it's not exactly trivial to get this 
working, but I'm hoping to release my FlashPaperLoader component and 
support files sometime in the near future.

Good luck,

-d

[1] 
http://www.adobe.com/support/documentation/en/flashpaper/2/flashpaper_api/flashpaper_api4.html

Nick Collins wrote:
>
> I'm having problems loading a FlashPaper document into a SWFLoader. It 
> loads just fine, but the scaling isn't as I'd like it. Instead of 
> scaling like it does when you load it into a browser window, where the 
> controls stay the same height and just the viewing area scales, the 
> FlashPaper maintains it's default scaling. I think the default size is 
> like 400 x 300, and it just scales that, control bar and all. Is there 
> any way within the SWFLoader to have the FlashPaper display like it 
> does in the browser window?
>
>  



--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to