6
votes

Does anyone know what criterea Flash uses for discovering the Live Preview class for a Component?

Background

We are attempting to automate the creation of a SWC that contains a component to be used from Flash. We are able to make it visible to flash by modifying the manifest.xml and wiring up the component definitions. However, the component cannot be dragged onto the stage (or library), presumably because it has no form of LivePreview.

To give better clarification of where we are coming from, we've noticed the following in SWCs exported from Flash (using swfdump):

  • fl.livepreview.LivePreviewParent contains the same mod attribute as the visual component in the manifest.xml file
  • fl.livepreview.LivePreviewParent is exported as a symbol
  • The short-named component (ie. no package, referenced in the components definition in the manifest.xml) is exported as a symbol

However, I can see no other differences between that and the SWC from Flex.

We can obviously use JSFL to perform the task, but we'd rather not install Flash on the build server.

Any thoughts?

2

2 Answers

0
votes

You can use UIComponentGlobals.designMode property.

import mx.core.UIComponentGlobals;

private function onInitialize():void { if ( UIComponentGlobals.designMode ) { // show something design view specific } else { //render normally } }

more info here, http://cookbooks.adobe.com/post_How_do_I_detect_at_runtime_if_my_component_is_bein-13446.html

0
votes

You need to extract the .swc file, it will contain a library.swf, which you will have to use as your LivePreview. When you make the changes in the properties of the component, those changes will get reflected in the LivePreview. If your have many components, you will have to generate live preview for each one of those. I had done it while developed components in Flash Authoring Tool, using v3 Component architecture.

Hope that helps..

-- Best; Chetan http://chetansachdev.com