求解IBM的blackgauges这个例子

hy158753228 2012-06-11 10:42:31
刚刚开始接触FLEX,下了个TourdeFlex,看里面的代码。
最近项目中有用到仪表盘和温度计的Chart,所以找到gauges这个例子时很高兴,刚刚好可以用得上。
不过我把这个例子的代码复制到MyEclipse(安装好FLEX4.6的插件了)中时有错误:

Could not resolve <ibm:CircularLinearGauge> to a component implementation.	gaugex.mxml
Could not resolve <ibm:VLinearGauge> to a component implementation. gaugex.mxml


看了下,应该问题是出在这里了:xmlns:ibm="http://www.ibm.com/xmlns/prod/ilog/elixir/2010" xmlns:local="*"
那个local应该是指定到本地的elixir(IBM的一个FLEX项目吧),因为没有安装elixir,所以出错,不知道我这个理解是不是对的。

然后去IBM官网找elixir下载,更加杯具的发现这东西是要银子的,找个试用版的,还居然下载不鸟,速度出奇的慢。
求解决方案,谢谢啦。

下面是TourdeFlex中blackgauges.mxml这个Chart例子的代码:
<?xml version="1.0" encoding="utf-8"?> 
<!--
///////////////////////////////////////////////////////////////////////////////
// Licensed Materials - Property of IBM
// 5724-Y31,5724-Z78
// © Copyright IBM Corporation 2007, 2011. All Rights Reserved.
//
// Note to U.S. Government Users Restricted Rights:
// Use, duplication or disclosure restricted by GSA ADP Schedule
// Contract with IBM Corp.
///////////////////////////////////////////////////////////////////////////////
-->
<s: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:ibm="http://www.ibm.com/xmlns/prod/ilog/elixir/2010" xmlns:local="*"
viewSourceURL="srcview/index.html"
creationComplete="init()">
<fx:Declarations>
<s:GlowFilter id="glow" color="0xFFFFFF" alpha="0.4" blurX="10"
blurY="10" quality="2" strength="2"/>
<s:Animate id="animate1" target="{carGauge}" duration="5000"
effectEnd="restartAnimate(animate1, 7)">
<s:motionPaths>
<s:SimpleMotionPath property="value1" valueFrom="0" valueTo="4"/>
</s:motionPaths>
</s:Animate>
<s:Animate id="animate2" target="{circularLinearGauge}" duration="5000"
effectEnd="restartAnimate(animate2, 100)">
<s:motionPaths>
<s:SimpleMotionPath property="value" valueFrom="0" valueTo="4"/>
</s:motionPaths>
</s:Animate>
<s:Animate id="animate3" target="{verticalLinearGauge}" duration="5000"
effectEnd="restartAnimate(animate3, 100)">
<s:motionPaths>
<s:SimpleMotionPath property="value" valueFrom="0" valueTo="4"/>
</s:motionPaths>
</s:Animate>
<s:Animate id="animate4" target="{carGauge}" duration="5000"
effectEnd="restartAnimate(animate4, 100)">
<s:motionPaths>
<s:SimpleMotionPath property="value2"/>
</s:motionPaths>
</s:Animate>
</fx:Declarations>
<fx:Script>
<![CDATA[
import spark.effects.easing.Bounce;
import spark.effects.easing.Elastic;
import spark.effects.easing.Linear;
import spark.effects.easing.Power;
import spark.effects.easing.Sine;

private var easers:Array = [new Elastic(), new Bounce(), new Linear(), new Power(), new Sine()];

import spark.filters.GlowFilter;

private function init():void
{
restartAnimate(animate1, 7);
restartAnimate(animate2, 100);
restartAnimate(animate3, 100);
restartAnimate(animate4, 100);

}

private function restartAnimate(anim:Animate, max:Number):void
{
var mp:SimpleMotionPath = anim.motionPaths[0] as SimpleMotionPath;
anim.easer = easers[int(Math.random() * (easers.length-1))];
mp.valueFrom = anim.target[mp.property];
mp.valueTo = Math.random() * max;
anim.startDelay = Math.random() * 15000;
anim.duration = 5000 + Math.random() * 5000;
anim.play();
}

private function truncateNumber(o:Object):String
{
return Number(o).toFixed(2);
}
]]>
</fx:Script>

<s:Rect width="100%" height="100%">
<s:fill>
<s:LinearGradient rotation="90">
<s:entries>
<s:GradientEntry color="0x000000"/>
<s:GradientEntry color="0x323232"/>
</s:entries>
</s:LinearGradient>
</s:fill>
</s:Rect>
<s:HGroup width="100%" height="100%" paddingBottom="10"
paddingLeft="10" paddingRight="10" paddingTop="10"
gap="10">
<ibm:CircularLinearGauge id="circularLinearGauge" width="100%" height="100%" filters="{[glow]}"
trackMinimum="60" trackMaximum="100"
slideDuration="0"
liveDragging="false"
labelFormatFunction="truncateNumber"/>
<local:CarGauge id="carGauge" width="100%" height="100%"
skinClass="CarGaugeSkin"
title="@Resource(key='rpm', bundle='blackgauges')"/>
<ibm:VLinearGauge id="verticalLinearGauge" height="100%"
trackMinimum="0" trackMaximum="100"
filters="{[glow]}"
slideDuration="0"
majorTickInterval="20" minorTickInterval="10"
orientation="btt"
labelFormatFunction="truncateNumber"/>
</s:HGroup>
</s:Application>




...全文
164 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
hy158753228 2012-06-11
  • 打赏
  • 举报
回复
或者有IBM的elixir的swc文件么?
hy158753228 2012-06-11
  • 打赏
  • 举报
回复
二了,那具local的namesapce解释不对,见谅,刚刚开始学flex
hy158753228 2012-06-11
  • 打赏
  • 举报
回复
真心求解
附上图片以供参考:

4,328

社区成员

发帖
与我相关
我的任务
社区描述
多媒体/设计 Flex
社区管理员
  • Flex
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧