There was a good blog entry about this but no clue where it is.

Here's the 411:

- LivePreview in MX 2004 & 8 expects components to be used
- components defined as something that extends mx.core.UIComponent
- LivePreview uses that mm_livepreview.as class you found to compile the SWF 
when you compile your components (SWC, Compiled Clip).
- mm_livepreview.as calls setSize; that's why when you scale you're 
components, they re-size nicely.  If you implement a good setSize/size 
method, then you're livepreview will work good too.
- When you compile an SWC, your component is converted into a SWF file 
amongst other things.  The LivePreview uses your ACTUAL compiled component 
in the SWF to show.  In MX and 5 you had to compile these manually.  Now, 
compiled clips and SWC's are handled in the IDE for you.
- while you can use onUpdate if you wish, it can feel messy merging 
livepreview code into your production code.  The only solace is "if ( 
_global.isLivePreview )".  If that's true, your component is running in the 
live preview window.
- you NEED to have something on frame 1 for the LivePreview to have drawing 
room.  I usually use the standard BoundingBox.  It just needs to be 1 x 1 
pixel, but I suggest making 100x100 or whatever the default value your 
component is since bounding box technically sets it.
- if you are not using UIComponent, you might want  to build the livepreview 
swf manually...
- the LivePreview actually runs a seperate SWF instance in the player. 
However, this SWF instance somehow shares the same global memory, so other 
livepreviews can somehow "know" about variables from other ones.  This is 
because of the magic mm_livepreview.as is doing.  I never figured it out.
- they cannot see library stuff because they are not FLA's, they are 
compiled SWF's, and secondly, the Library is not a compiled SWF, it's a set 
of assets in the binary FLA, not compiled to SWF.  The LivePreview is 
showing yoru compiled component, and any assets in it.  If you want it to 
show something in the LivePreview, put it in the component, and re-compile 
it to compiled clip or SWC.

----- Original Message ----- 
From: "Frederick N. Brier" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Friday, March 03, 2006 9:38 AM
Subject: [Flashcoders] Trying to understandi Live Preview


I have been mucking with this for several days and would love if someone 
could point me at an up-to-date explanation of how live preview is supposed 
to be done.

I have read about the old style of doing it using onUpdate() and an external 
.swf.

I have watched trace() statements execute my init(), createChildren(), 
constructors and property setters.

I have read posts saying that live preview mode does not support depths 
(only one depth), which can't be right (more prayerful), because most custom 
components are going to dynamically add MovieClips and graphics.

I have looked at mm_livepreview.as and read through the comments, but am 
unsure as to how it fits in the scheme of things.

Code using attachMovie and loadBitmap to load graphics or bitmaps from the 
library work in test mode, but return undefined in Live Preview.  Why can't 
I load graphics or bitmaps from the library?  Obviously MovieClip symbols 
show up.

Other than the simple triangle sample on the Macromedia web site which uses 
the old onUpdate/external .swf approach, there seems to be very little on 
this topic.  Please, just point me in the right direction!!  Thank you.

Fred.


_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com 

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to