1

我正在尝试将 Flexlib 的调度示例 1 转换为视图。

https://github.com/flex-users/flexlib

当我将它放在视图中时,我遇到了这一行的问题:

<flexlib:ScheduleViewer id="scheduleViewer"  
            width="600" height="400" 
            dataProvider="{dataProvider }"       
            startDate="{startDate}" endDate="{endDate}" />

我注意到当我有这条线时:

xmlns:flexlib="http://code.google.com/p/flexlib/" 

我收到了这个错误:

Could not resolve <flexlib:ScheduleViewer> to a component implementation.

当我将该行更改为:

xmlns:flexlib="libs.flexlib.scheduling.*"

我收到此错误:

1046: Type was not found or was not a compile-time constant: ScheduleViewer.

此外,我已将 flexlib.swc 放入我的 libs 文件夹中。这是整个代码:

<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:mx="library://ns.adobe.com/flex/mx"  
    xmlns:s="library://ns.adobe.com/flex/spark"
    xmlns:flexlib="libs.flexlib.scheduling.*"
    creationComplete="onCreationComplete();">

<fx:Style>
    .myEntryStyle {
        fillAlphas: 1, 1;
        fillColors: #ff0000, #990000;
        timeStyleName: "myTimeStyle";
        color: #000000;
    }
    .myTimeStyle {
        fontSize: 9;
        fontWeight: bold;
        color: #ffff00;
    }
</fx:Style>

<fx:Script>
    <![CDATA[
        import flexlib.scheduling.scheduleClasses.SimpleScheduleEntry;
        import flexlib.scheduling.util.DateUtil;
        import mx.collections.ArrayCollection;

        [Bindable]         
        private var dataProvider : ArrayCollection;         
        [Bindable]
        private var startDate : Date;
        [Bindable]
        private var endDate : Date;

        private function onCreationComplete() : void
        {
            setTimeframe();
            initDataProvider();
        }

        private function setTimeframe() : void
        {
            startDate = DateUtil.clearTime( new Date() );
            endDate = getEndDate( startDate );
        }

        private function getEndDate( startDate : Date ) : Date
        {
            var duration : Number = DateUtil.DAY_IN_MILLISECONDS * 1;
            var endDate : Date = new Date( startDate.getTime() + duration );
            return endDate;
        }

        private function initDataProvider() : void
        {
            var entries : ArrayCollection = new ArrayCollection();
            var entry : SimpleScheduleEntry = new SimpleScheduleEntry();
            entry.startDate = DateUtil.clearTime( new Date() );
            entry.endDate = new Date( entry.startDate.getTime() + DateUtil.HOUR_IN_MILLISECONDS * 5 );
            entry.label = "Our first entry!";
            entries.addItem( entry );

            entry = new SimpleScheduleEntry();
            entry.startDate = DateUtil.setTime( new Date(), DateUtil.HOUR_IN_MILLISECONDS );
            entry.endDate = new Date( entry.startDate.getTime() + DateUtil.HOUR_IN_MILLISECONDS * 15 );
            entry.label = "Our second entry!";
            entries.addItem( entry );

            entry = new SimpleScheduleEntry();
            entry.startDate = DateUtil.setTime( new Date(), DateUtil.HOUR_IN_MILLISECONDS * 13 );
            entry.endDate = new Date( entry.startDate.getTime() + DateUtil.HOUR_IN_MILLISECONDS * 5 );
            entry.label = "Our third entry!";
            entries.addItem( entry );

            dataProvider = entries;
        }
    ]]>
</fx:Script>

<flexlib:ScheduleViewer id="scheduleViewer"  
                        width="600" height="400" 
                        dataProvider="{ dataProvider }"       
                        startDate="{ startDate }" endDate="{ endDate }" />
    </s:View>

有人知道我将此示例转换为视图的问题是什么吗?

4

0 回答 0