Luar's Flash Playground:開發組件常見問題FAQ
開發組件常見問題FAQ (20-05-2005)
我的kclyComponent不是胎死腹中,一直有進行中,開發組件中遇到不少問題,這些都是因為Flash太多Undocumented的秘技,什麼都沒有說清楚,使大家白白浪費不少時間,所以我將遇到問題和解決方法整理在此,方便自己和其他人日後參考(由於我平日開發文檔都是英文,沒有時間翻譯,索性Copy and Paste,見諒,以後會陸續更新):
  1. Why UIObject can call dispatchEvent?

    Check mx.core.ext.UIObjectExtensions, it calls UIEventDispatcher.initialize(ui); (line 51), so if your custom component is not UIObject based, you need to do your own EventDispatcher.initialize

  2. How to enable Live Preview for changing value inside Component Property Panel?

    Put [Inspectable] in Getter/Setter Method, not in class property declaration. Check Inspectable Getters and Setters and Live Preview

  3. If the user resize the component during Live Preview, how to make the component reflect the change?

    A method call setSize(w,h) must be defined in the component class or parent class.

  4. Custom component (not UIObject based) not work in Flash Player 6 when define [Inspectable] in Getter/Setter Method?


  5. Why multiple component instances of same type of component shared the same property when convert to compiled clip?

    It is not that problem, see next question.

  6. Why attachMovie not work when convert to compiled clip?

    All linkage symbol must be Movie Clip, if it is not export in 1st Frame, in Frame 2 of asset layer, the symbol type must be Movie Clip, too.

  7. Should I use a Button symbol if I need a button in a component?

    Button symbol can be set linkage and attached by attachMovie(), however it cannot dynamically add onRelease such event handler. If you use 4 frames Movie Clip (without 1st frame stop), it can dynamically add onRelease such event handler, "onRollOver frame change effect" will auto triggered, i.e. Movie Clip become a real Button. However, when converted to compiled clip, such "onRollOver frame change effect" will loss. Therefore, you need to handle onRollOver event for moving the Movie Clip to frame 2, also need to make 1st frame stop.

  8. Then, can I embed a Button inside Movie Clip for attach?

    It is not a good solution because it is hard to add action to the Button. You cannot ask the designer to add some pre-defined function call on the Button, or using a pre-defined Button instance name.

本文章由發表。
意見
"; print "沒有意見。
 "; } ?>
  • 好文章!

    egoldy於21-05-2005發表

  • 受用,希望您未來能繼續po相關文章..

    CHUN於21-05-2005發表

  • ............
    唉,谁叫我不好好学英语 :(

    harry於21-05-2005發表

  • "A method call setSize(w,h) must be defined in the component class or parent class."

    我看到MM文档上推荐开发V2架构的组件时定义一个
    size()方法而不是setSize(w,h),我在开发组件时使用的都是
    size(),运行良好。setSize(w,h)没有试过。

    jackyshe於27-05-2005發表

  • setSize有時會再call size

    luar於27-05-2005發表

  • 我不認識英文啊~人家看不懂~嗚~

    由大頭於05-08-2005發表

同組文章