软硬度:需要帮助实现自定义组件code的虚线 [英] Flex: need help implementing custom component code for dashed lines

查看:105
本文介绍了软硬度:需要帮助实现自定义组件code的虚线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的Flex,我一直在试图找出如何使用下面的code中的Flex 4

I'm new to Flex, and I've been trying to figure out how to use the following code for creating dashed lines in Flex 4.

<一个href="http://riarange.word$p$pss.com/2010/10/29/how-to-create-a-dotted-line-or-dashed-line-in-flex-4/" rel="nofollow">http://riarange.word$p$pss.com/2010/10/29/how-to-create-a-dotted-line-or-dashed-line-in-flex-4/

我希望有人谁知道更好的Flex可以简单地提供一个完整的(最小)例如使用该code画一条虚线。我无法把拼在一起,我觉得笔者认为一些我缺乏基本的知识。如果我有一个工作的例子,我可以弄清楚如何使它适应我的需要。

I was hoping someone who knew Flex better could simply provide a complete (minimum) example that uses this code to draw a dashed line. I'm having trouble putting the pieces together, and I think the author assumed some basic knowledge that I lack. If I had a working example I could figure out how to adapt it to my needs.

先谢谢您的任何意见/帮助。如果有更好的code为虚线,很想知道。

Thanks in advance for any comments/help. If there's better code for dashed lines, would love to know.

更新:

我把自定义组件code到在COM目录中DottedLine.mxml文件。现在,我越来越出现在℃的误差;组件:组&gt; 行,上面写着:无法解析&LT;组件:组&gt;一个组件实现。

I placed the custom component code into a DottedLine.mxml file in the com directory. Now, I'm getting an error that appears at the <components:Group> line that says: Could not resolve <components:Group> to a component implementation.

<mx:Application 
    xmlns:fx="http://ns.adobe.com/mxml/2009" 
    xmlns:s="library://ns.adobe.com/flex/spark" 
    xmlns:mx="library://ns.adobe.com/flex/mx"
    xmlns:components="com.*"
    minWidth="955" minHeight="600" xmlns:com="com.*">

<fx:Script><![CDATA[
    import mx.collections.ArrayCollection;
    [Bindable]
    public var expenses:ArrayCollection = new ArrayCollection([
    {Month:1, Profit:2000, Expenses:1500, Amount:450},
    {Month:2, Profit:1000, Expenses:200, Amount:600},
    {Month:2.05, Profit:1000, Expenses:500, Amount:300},
    {Month:2.1, Profit:1000, Expenses:500, Amount:450},
    {Month:2.15, Profit:1000, Expenses:200, Amount:600},
    {Month:2.2, Profit:1000, Expenses:500, Amount:300},
    {Month:2.25, Profit:1000, Expenses:500, Amount:450},
    {Month:2.3, Profit:1000, Expenses:200, Amount:600},
    {Month:2.35, Profit:1000, Expenses:500, Amount:300},
    {Month:2.4, Profit:1000, Expenses:500, Amount:450},
    {Month:2.45, Profit:1000, Expenses:200, Amount:600},
    {Month:2.5, Profit:1000, Expenses:500, Amount:300},
    {Month:2.55, Profit:1000, Expenses:500, Amount:450},
    {Month:2.6, Profit:1000, Expenses:200, Amount:600},
    {Month:2.65, Profit:1000, Expenses:500, Amount:300},
    {Month:2.7, Profit:1000, Expenses:500, Amount:450},
    {Month:2.75, Profit:1000, Expenses:200, Amount:600},
    {Month:2.8, Profit:1000, Expenses:500, Amount:300},
    {Month:2.85, Profit:1000, Expenses:500, Amount:450},
    {Month:2.9, Profit:1000, Expenses:200, Amount:600},
    {Month:6, Profit:1500, Expenses:500, Amount:300}
    ]);

]]></fx:Script>

<mx:Panel title="Line Chart With Strokes">

    <mx:LineChart id="myChart" dataProvider="{expenses}" showDataTips="true" seriesFilters="{new Array}">
        <mx:horizontalAxis>
            <mx:LinearAxis />
        </mx:horizontalAxis>
        <mx:series>
            <mx:LineSeries xField="Month" yField="Expenses" displayName="Expenses">
                <mx:lineStroke>
                    <mx:SolidColorStroke id="s1" color="0xBD171B" weight="4"/>
                </mx:lineStroke>
            </mx:LineSeries>
            <mx:LineSeries xField="Month" yField="Amount" displayName="Amount">
                <components:Group>
                    <components:DottedLine width="500" height="2" dotColor="0xFFFFFF" dotWidth="3" dotAlpha="1" />      
                </components:Group>
            </mx:LineSeries>
        </mx:series>
    </mx:LineChart>
    <mx:Legend dataProvider="{myChart}" direction="horizontal"/>
</mx:Panel>

推荐答案

我没有这些在Flex 3的,但相信他们都应该工作在Flex 4中也还有一些其他的例子,在那里,有比我有更好的,哪些您发布,但它实际上取决于你如何去应用虚线。如果这没有帮助让我知道,我会尽力澄清: http://www.shaunhusain.com/TestDashedLines/index.html

I did these in Flex 3 but believe they should both work in Flex 4 too, there're other examples out there that are better than what I have and what you posted but it really depends on how you're going to apply the dashed lines. If this doesn't help let me know and I'll try to clarify: http://www.shaunhusain.com/TestDashedLines/index.html

http://www.shaunhusain.com/TestDashedLines/index2.html

http://www.shaunhusain.com/TestDashedLines/srcview/

我现在看到的是在一个项目中的两个应用程序,第一页是用它制成的基本绘制HRule但短线的SimpleDashedLine类的输出。二是对其他对象的图形顶部绘制任意直线。

What I've got here is two applications in one project, the first page is the output using the SimpleDashedLine class which is made for basically drawing an HRule but with dashes. The second is for drawing arbitrary straight lines on top of other objects graphics.

这篇关于软硬度:需要帮助实现自定义组件code的虚线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆