コンポーネントのスキンをライブラリ内の別のスキンに置き換える機能を備えた一連の Flash コンポーネントを構築しています。
現在、アプリケーションの実行後にライブラリにアクセスできますが、ライブ プレビュー中はアクセスできません。ライブ プレビュー モード (ドラッグできるモード) で実行中にコンポーネントがライブラリにアクセスできるかどうかを知りたいです。ステージの周りのコンポーネントを変更し、[コンポーネント パラメータ] ウィンドウでそのプロパティを変更します)
Here is a simplified code that just looks to see if there is a symbol of the name specified and than instantiates it and adds it as a child.
package
{
import fl.core.UIComponent;
import flash.display.MovieClip;
import flash.system.ApplicationDomain;
/**
* ...
* @author Roy Lazarovich
*/
public class CompTest extends UIComponent
{
private var customfile :String;
public function CompTest()
{
}
override protected function configUI():void
{
}
override protected function draw():void
{
super.draw();
}
private function setCustomFile():void
{
if (ApplicationDomain.currentDomain.hasDefinition(customfile))
{
var c:Class = Class(ApplicationDomain.currentDomain.getDefinition(customfile));
var mc:MovieClip = new c();
addChild(mc);
}
}
[Inspectable(name = "_Custom File", defaultValue = "")]
public function set _customfile(value:String):void
{
customfile = value;
setCustomFile();
drawNow();
}
}
}
ありがとう!