Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache flex 如何在flash builder中使用flex中的actionscript分别更改矢量图形中的填充和笔划_Apache Flex_Actionscript_Flash Builder_Transform_Colortransform - Fatal编程技术网

Apache flex 如何在flash builder中使用flex中的actionscript分别更改矢量图形中的填充和笔划

Apache flex 如何在flash builder中使用flex中的actionscript分别更改矢量图形中的填充和笔划,apache-flex,actionscript,flash-builder,transform,colortransform,Apache Flex,Actionscript,Flash Builder,Transform,Colortransform,如果我有一个填充为蓝色、笔划为橙色的矩形,如何使用ActionScript将笔划更改为黑色,并将填充更改为红色 当我使用以下代码时,它将整个矩形更改为0x008000绿色。填充覆盖笔划或将填充和笔划都更改为0x008000绿色 var myColor:ColorTransform = myRectangle.transform.colorTransform; savedColor = myRectangle.transform.colorTransfor

如果我有一个填充为蓝色、笔划为橙色的矩形,如何使用ActionScript将笔划更改为黑色,并将填充更改为红色

当我使用以下代码时,它将整个矩形更改为0x008000绿色。填充覆盖笔划或将填充和笔划都更改为0x008000绿色

var myColor:ColorTransform = myRectangle.transform.colorTransform;

                    savedColor = myRectangle.transform.colorTransform;

                    myColor.color = 0x008000;

                    myRectangle.setColorTransform(myColor);
我注意到,当我转换回保存的颜色时,它会根据我的需要恢复原始填充和笔划颜色

            myRectangle.setColorTransform(savedColor);
在第一次更改矩形时,如果不保存,我就无法将其更改为不同的填充颜色和笔划颜色

我想能够做的是设置填充和笔划为不同的颜色,还可以控制填充是否覆盖笔划

请参阅下面一个简单的flex程序,您可以使用它进行调整,如果您能找到答案,请给出回复:

提前谢谢 劳伦斯

给他们身份证:

          <s:Graphic version="2.0"  xmlns:d="http://ns.adobe.com/fxg/2008/dt" xmlns:fc="http://ns.adobe.com/flashcatalyst/2009"  viewHeight= "645" viewWidth= "1043">
                <s:Path winding="evenOdd" data="M 341 30 C 341 19 350 10 361 10 C 372 10 381 19 381 30 C 381 41 372 50 361 50 C 350 50 341 41 341 30 Z " blendMode="normal" alpha="1" id="GEN1">
                      <s:fill>
                            <s:SolidColor color="#b6b6b6" id="fill"/>
                      </s:fill>
                      <s:stroke>
                            <s:SolidColorStroke color="#333333" weight="4" caps="none" id="stroke"/>
                      </s:stroke>
                </s:Path>
          </s:Graphic>     

非常感谢你的回答。我不能从GEN1对象的id访问它吗?我问这个问题的原因是,我的应用程序中有数百个向量对象,这将大大增加我必须跟踪的ID的数量。提前感谢您的帮助。填充和笔划是gen1对象的属性。所以您可以这样做:gen1.fill.color==0x000000;或gen1.stroke.color=0xffffff;
          <s:Graphic version="2.0"  xmlns:d="http://ns.adobe.com/fxg/2008/dt" xmlns:fc="http://ns.adobe.com/flashcatalyst/2009"  viewHeight= "645" viewWidth= "1043">
                <s:Path winding="evenOdd" data="M 341 30 C 341 19 350 10 361 10 C 372 10 381 19 381 30 C 381 41 372 50 361 50 C 350 50 341 41 341 30 Z " blendMode="normal" alpha="1" id="GEN1">
                      <s:fill>
                            <s:SolidColor color="#b6b6b6" id="fill"/>
                      </s:fill>
                      <s:stroke>
                            <s:SolidColorStroke color="#333333" weight="4" caps="none" id="stroke"/>
                      </s:stroke>
                </s:Path>
          </s:Graphic>     
fill.color = 0x000000;
stroke.color = 0xffffff;