1월 31, 2007 at 3:59 오전
· Filed under Flex2 열공
문자열은 파라미터 형태로 정의하면 URLVariables를 사용하여 문자열을 자를수 있습니다.
var str:String = “ans=12334&msg=이거다”;
var variables:URLVariables = new URLVariables();
variables.decode(str);
txtArea.text = variables.ans; //-> 12334
txtArea.text += variables.msg; //-> 이거다
Permalink
1월 31, 2007 at 2:19 오전
· Filed under Flex2 열공
Permalink
1월 26, 2007 at 7:24 오전
· Filed under Flex2 열공
이미지가 동적으로 로딩될때 로딩이미지 표시하는 예제
<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml” layout=”absolute” backgroundColor=”#000000″ >
<mx:Button label=”View Image” horizontalCenter=”0″ top=”5″ click=”imageCanvas.visible = true;sceneImage.load()” />
<mx:Canvas id=”imageCanvas” verticalScrollPolicy=”off” horizontalScrollPolicy=”off” backgroundColor=”#000000″ top=”40″ height=”100%” width=”100%” visible=”false”>
<mx:Image id=”sceneImage” autoLoad=”false” source=”img/car_small_1.jpg” verticalCenter=”0″ horizontalCenter=”0″ />
<mx:Image id=”loadingIcon” source=”@Embed(’loading.gif’)” horizontalCenter=”0″ verticalCenter=”0″ visible=”{sceneImage.percentLoaded != 100}” />
<mx:Label text=”Loading…” verticalCenter=”18″ horizontalCenter=”0″ color=”#ffffff” fontSize=”10″ visible=”{sceneImage.percentLoaded != 100}” />
</mx:Canvas>
</mx:Application>
Permalink
1월 26, 2007 at 1:43 오전
· Filed under Flex2 링크
대부분 데이터 객체만 가지고 Binding을 사용하지만 Boolean 속성이라든지 특정 함수 리턴값을 가지고 Binding을 확장해서 사용 할 수도 있습니다.
———————————————————
[Bindable]
private var labelText:String = “This is a label”;
<mx:Label text=”{labelText}”/>
———————————————————
[Bindable]
private var items:ArrayCollection;
<mx:Label text=”You have {items.length} items.”/>
———————————————————
<mx:TextInput id=”myInput”/>
<mx:Button label=”Do Something” enabled=”{myInput.text.length > 0}”/>
———————————————————
private function isButtonEnabled(someString:String, itemLength:uint):Boolean
{
if (…) {
myButton.label = “I’m enabled!”;
return true;
} else {
myButton.label = “I’m disabled.”;
return false;
}
}
<mx:Button id=”myButton” enabled=”{isButtonEnabled(someString, items.length)}”/>
———————————————————
원문:http://weblogs.macromedia.com/cantrell/archives/2006/11/fun_with_flex_d.cfm
Permalink
1월 26, 2007 at 1:31 오전
· Filed under Apollo
Permalink
1월 26, 2007 at 1:08 오전
· Filed under Flex2 링크
Permalink
1월 26, 2007 at 12:47 오전
· Filed under Flex2 링크
Permalink
1월 25, 2007 at 4:41 오전
· Filed under Flex2 열공
말그대로 이미지 버튼 컴포넌트 이다.
더블클릭 방지 기능도 포함됨…
속성중에 DOUBLECLICK_DELAY값을 변경하여 더블클릭 방지 시간을 수정하면 된다.
그리고 마우스오버,아웃시 fade 효과도 추가했음.
– ButtonImage.mxml
<mx:Image buttonMode=”true” useHandCursor=”true” mouseChildren=”false” xmlns:mx=”http://www.adobe.com/2006/mxml” creationComplete=”createContent()”>
<mx:Metadata>[Event("clickDispatch")]</mx:Metadata>
<mx:Script>
<![CDATA[
import flash.events.Event;
import mx.effects.Fade;
private var DOUBLECLICK_DELAY:Number = 100;
private var timer:Number = 0;
private function createContent():void
{
this.addEventListener(MouseEvent.MOUSE_OVER,mouseOverEvt);
this.addEventListener(MouseEvent.MOUSE_OUT,mouseOutEvt);
this.addEventListener(MouseEvent.MOUSE_DOWN,mouseDownEvt);
}
private function mouseOverEvt(event:Event):void
{
var fadeIn:Fade = new Fade(this);
fadeIn.alphaFrom = 1.0;
fadeIn.alphaTo = 0.5;
fadeIn.duration = 300;
fadeIn.play();
}
private function mouseOutEvt(event:Event):void
{
var fadeOut:Fade = new Fade(this);
fadeOut.alphaFrom = 0.5;
fadeOut.alphaTo = 1.0;
fadeOut.duration = 300;
fadeOut.play();
}
private function mouseDownEvt(event:Event):void
{
if(!this.visible) return;
var currentTime:Number = getTimer();
if (currentTime - timer > DOUBLECLICK_DELAY) {
timer = getTimer();
dispatchEvent(new Event("clickDispatch"));
}
}
]]>
</mx:Script>
</mx:Image>
Permalink
1월 25, 2007 at 4:32 오전
· Filed under Flex2 열공
간만에 좋은 소식이 올라왔네요…
전에 Flex 자동빌드를 Ant 빌드로 변경하는데 꽤 고생을 했던 기억이 납니다.
Flex Ant tasks를 사용하면 빌드파일 만들때 task를 정의하여 mxmlc,comp와 같은 커맨드 명령어를 쉽게 만들 수 있겠네요.
일단 파라미터를 태그형태로 정의 할 수 있으니까. 가독성도 좋고 보기도 좋고 하지만 성능은 똑같다는거….
– 샘플 –
~~~~
<property name=”FLEX_HOME” value=”C:/flex_sdk_2″ />
<taskdef resource=”flexTasks.tasks” classpath=”./util/flexTasks.jar” />
<target name=”compile”>
<echo>Building ${swfFile}</echo>
<mxmlc
file=”${main_appliation}”
output=”${swfFile}”
actionscript-file-encoding=”UTF-8″
keep-generated-actionscript=”true”
incremental=”true”
services=”${flex2_project}/WEB-INF/flex/services-config.xml”
>
<load-config filename=”${flex2_project}/WEB-INF/flex/flex-config.xml”/>
<runtime-shared-libraries url=”20_Cairngorm2.swf”/>
<runtime-shared-libraries url=”20_DashboardLib.swf”/>
<compiler.external-library-path dir=”${lib_project}” append=”true”>
<include name=”lib/20_Cairngorm2.swc” />
<include name=”bin/20_DashboardLib.swc” />
</compiler.external-library-path>
<default-size width=”500″ height=”600″ />
</mxmlc>
</target>
~~~
Flex compiler shell은 mxmlc와 비슷한 놈인데 컴파일했던 정보들을 캐쉬형태로 저장하여 다음 번 컴파일때 캐쉬를 사용하여 컴파일 성능을 향상시켰다고 합니다. 단 FlexBuilder를 사용하면 필요가 없다고 합니다. 기본적으로 빌더에 포함되 있다네요.
Permalink
예전 글 »