开发者

Flex Embed png, meta data required

this is a part of my code

        [Embed(source='dmr/images/icones/icnPresenceInline.png')];
        [Bindable]
        private var presentAuBureau:Class;

        [Embed(source="dmr/images/icones/icnVacancesInline.png")];
        [Bindable]
        private var enCongeAujourdhui:Class;

        override public function set data (value:Object):void {
            super.data = value
            if(data.onLeaveToday开发者_Python百科 == true) {
                etat.source = new presentAuBureau();
                etat.toolTip = "Présent au bureau";
            }
            if(data.presence == '1') {
                etat.source = new enCongeAujourdhui();
                etat.toolTip = "En congé aujourd'hui";
            }
        }

It doesn't compile .. trouble with "meta data requires an associated definition. I can't find what's missing ... all examples i've googled are somehow the same code.

Any hint please ??

TIA


Remove the ; after the [Embed] meta data tags:

[Embed(source='dmr/images/icones/icnPresenceInline.png')]
[Bindable]
private var presentAuBureau:Class;

[Embed(source="dmr/images/icones/icnVacancesInline.png")]
[Bindable]
private var enCongeAujourdhui:Class;

The [ ] meta data tags are descriptors that describe the following object. In this case the private variables. So they belong together and as such are not separated by a semicolon.

Also you should cast your objects to the correct types when using them. This doesn't matter in your explicit case (as you assign the objects to a generic Object), but it might become a problem later:

etat.source = new presentAuBureau() as BitmapAsset;


  1. sometimes flex is crazy about paths try first to use [Embed(source='/dmr/images/icones/icnPresenceInline.png')] with / at the beginning of the relative path
  2. The error is at the end of the Bindable line. There should be no ";"
  3. Do not use etat.source = new presentAuBureau();

    Instead use etat.source = presentAuBureau;


Try Project>Clean from the main menu.

Make sure the path dmr/images/icones/icnVacancesInline.png is correct.

Test with other images see if they cause the same problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜