Quantcast
Channel: Cocos Forums - Latest topics
Viewing all articles
Browse latest Browse all 17085

Changing opacity on widget do not reflect on its child

$
0
0

@shashankA wrote:

Hi,

Steps to reproduce.

1- create an imageView
2- create labelTtf
3- add lavelTtf as child to imageView
4- setOpacity on imageView to 50 or anything less than 255

Opacity is only applied to imageView its not reflected to label

My code is-

 		var layout2 = ccui.ImageView.extend({

            ctor: function ( ) {

                this._super();
                this.setScale9Enabled(true);
                this.setCascadeColorEnabled(true);
                this.loadTexture("dropdown_insidebtn.png", ccui.Widget.PLIST_TEXTURE);
                this.attr({
                    x:400,
                    y:200,
                    width: 680,
                    height: 70,
                    anchorX: 0.5
                });

                var feeLabel = new cc.LabelTTF("1000");
                feeLabel.setFontSize(20);
                feeLabel.setPosition(this.width / 10, this.height / 2);
                feeLabel._setFont("res/Calibri.ttf");
                feeLabel.setColor(cc.color(0, 0, 0));
                this.addChild(feeLabel, 0);

                var join_btn = new ccui.Button();
                join_btn.setTouchEnabled(true);
                join_btn.loadTextures("add_cash_button.png", "add_cash_button.png", "add_cash_button.png", ccui.Widget.PLIST_TEXTURE);
                join_btn.setTitleFontSize(30);
                join_btn.setTitleColor(cc.color(0, 0, 0));
                join_btn.x = 5 * this.width / 10;
                join_btn.y = this.height / 2;
                join_btn.setTag(1);

                this.addChild(join_btn ,0);
            }
        });

        var layoutObj = new layout2();
        layoutObj.setOpacity(100);

        this.addChild(layoutObj, 6);

Posts: 2

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 17085

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>