简体   繁体   English

Flex中的程序化皮肤

[英]Programmatic skins in Flex

I am having 2 problems creating programmatic skin for Canvas. 我在为Canvas创建程序化皮肤时遇到2个问题。

First problem: I would like to have background with rounded corners and I am using GraphicsUtil.drawRoundRectComplex in order to have round corners for only the upper two corners. 第一个问题:我想使用带有圆角的背景,并且我正在使用GraphicsUtil.drawRoundRectComplex以便仅对上两个角使用圆角。 The problem is that drawRoundRectComplex takes for each corner one single parameter - the corner radius. 问题是drawRoundRectComplex为每个角采用一个单独的参数-角半径。 However my scaleX and scaleY factors are different and in fact the corners are not properly rounded because I either can set the radius using scaleX or scaleY. 但是我的scaleX和scaleY因子不同,并且实际上拐角没有适当地变圆,因为我可以使用scaleX或scaleY设置半径。 Graphics.drawRoundRect is better because it takes two parameters for the corners - elipse width and height and then you could apply both scale factors but it doesn't allow me to specify different radius for different corners. Graphics.drawRoundRect更好,因为它为拐角使用了两个参数-椭圆的宽度和高度,然后可以应用两个比例因子,但是不允许我为不同的拐角指定不同的半径。 I am looking for an idea how to use GraphicsUtil.drawRoundRectComplex when scaleX and scaleY are different. 我正在寻找一个在scaleX和scaleY不同时如何使用GraphicsUtil.drawRoundRectComplex的想法。

Second problem: Even though I set my programmatic skin through style - <> the skin's updateDisplayList gets executed only once and after that somehow "backgroundImage" style gets "undefined" and my programmatic skin is not associated anymore to the Canvas instance. 第二个问题:即使我通过样式设置了程序化皮肤-<>皮肤的updateDisplayList仅执行一次,然后以某种方式“ backgroundImage”样式变为“未定义”,并且我的程序化皮肤不再与Canvas实例相关联。 As a workaround I am setting on each resize event "backgroundImage" style again but this is ugly. 作为一种解决方法,我再次在每个调整大小事件“ backgroundImage”样式上进行设置,但这很丑陋。 What could cause such "silent" resetting of the "backgroundImage" style to undefined? 是什么导致“ backgroundImage”样式的这种“无声”重置为未定义?

Thanks! 谢谢!

isnt the backgroundImage supported by the RectangularBorder Class? RectangularBorder类是否支持backgroundImage?

Rectabgular Border at Adobe AS3 Reference Adobe AS3参考上的后方边框

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM