我想加載一個帶有按鈕皮膚的swf文件作爲圖像(在swf文件的庫中,我給出了'TickMark'的導出屬性)並設置皮膚使用StyleManager.setStyleDeclaration的彈性按鈕。使用StyleManager.setStyleDeclaration在Flex中設置按鈕皮膚
我收到錯誤,如'TickMark()上的參數計數不匹配。預計2,得到0。
這就是我要做的:
private function init():void
{
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,styleSWFLoaded);
loader.load(new URLRequest("styles.swf"),new LoaderContext(false,ApplicationDomain.currentDomain));
}
private function createStyle(styleName:String):void
{
var style:CSSStyleDeclaration = new CSSStyleDeclaration(styleName);
var cls:Class = ApplicationDomain.currentDomain.getDefinition(ss) as Class;
style.setStyle("upSkin",cls);
}
}
StyleManager.setStyleDeclaration(".buttonme",style,true);
}
當我將這一新風格「buttonme」的按鈕我收到以下錯誤:
ArgumentError: Error #1063: Argument count mismatch on TickMark(). Expected 2, got 0.
不知道這是爲什麼發生的事情,而奇怪的是,當我嵌入它的工作原理相同的SWF文件,如下圖所示:
[Embed(source="styles.swf", symbol="Tick")]
private var GraphicClass:Class;
如果我使用了G級在setStyleDeclaration中的raphicClass,它的工作原理...但基本上我想動態地。
還有其他簡單的方法來動態皮膚(圖像)彈性按鈕嗎?
Hi Lance, TickMark類在FLA文件(導出設置)中定義。由於我爲導出設置的資產是圖像,導出設置將基類作爲BitmapData。 BitmapData類需要兩個參數,即寬度和高度。 新的cls()發生在flex組件內部,我看到它正在調用沒有參數的。 應該指出,我們不能使用BitmapData作爲skin skin組件的資產,或者我們在這裏真的錯過了一些東西。 – Vipin 2010-02-09 13:40:18