독도 광고 모금 캠페인

[펌] ClassFactory 사용법

ADOBE 2008. 9. 27. 20:31

간만에 또 FLEX2을 하고 있습니다.
모 회사땜시...

그런데 ClassFactory를 사용해야하는 상황이네요 크흐..

간단히 사용법 올린 블로그가 있어서 소개합니다.

....(중략)......

<mx:DataGridColumn headerText="렌더러"  width="50">
   <mx:itemRenderer>
      <mx:Component>
         <mx:TextInput editable=false>
         </mx:TextInput>
      </mx:Component>
   </mx:itemRenderer>
</mx:DataGridColumn>

이렇게 표현 되는걸 Action Script로 만들어 보자. 

var renderer:ClassFactory = new ClassFactory(TextAlign);
renderer.properties = {editable:false};
var column:DataGridColumn = new DataGridColumn();
column.itemRenderer = renderer; 

이렇게 하면 위의 mxml 과 똑같은 결과가 나온다.

 ...... (중략 )..............

[출처] ActionScript로 Renderer 만들기.|작성자 친구처럼


하여간 예전버전 할때는 정말 거시기 하네요.. 쩝..

내용 보시려면 트랙백 걸어놨습니다... 귀찮으시면... 여기 클릭하셔야겠죠.. ㅡ.ㅡ;;

주말에도 일하고 슬픕니다.
Posted by 이현호
,
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2007/11/04/positioning-labels-in-a-flex-piechart-control/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white">
    <mx:Script>
        <![CDATA[
         import mx.controls.Alert;
         import com.hexagonstar.util.debug.Debug;
      private var _datas:Array = [ ["Level 1" , "1" , "Data 1-1","Data 1-2","Data 1-3","Data1-4","Data 1-5"],
          ["Level 2-1" , "2" , "Data 2-1","Data 2-2","Data 2-3","Data 2-4","Data 2-5"],
          ["Level 3-1" , "3" , "Data 3-1","Data 3-2","Data 3-3","Data 3-4","Data 3-5"],
          ["Level 4-1" , "4" , "Data 4-1","Data 4-2","Data 4-3","Data 4-4","Data 4-5"],
          ["Level 4-2" , "4" , "Data 5-1","Data 5-2","Data 5-3","Data 5-4","Data 5-5"],
          ["Level 2-3" , "2" , "Data 10-1","Data 10-2","Data 10-3","Data 10-4","Data 10-5"],
          ["Level 3-2" , "3" , "Data 6-1","Data 6-2","Data 6-3","Data 6-4","Data 6-5"],
          ["Level 2-2" , "2" , "Data 7-1","Data 7-2","Data 7-3","Data 7-4","Data 7-5"],
          ["Level 3-3" , "3" , "Data 8-1","Data 8-2","Data 8-3","Data 8-4","Data 8-5"],
          ["Level 3-4" , "3" , "Data 9-1","Data 9-2","Data 9-3","Data 9-4","Data 9-5"] ];
  
      private var _valueCount:int = 5;
            public function makeXMLClick():void
            {
             xmlData();
            }
       
            protected function xmlData():void
            {
             var dataLen:int = _datas.length;
             var mainXML:XML = new XML(<node />);
             var makeXML:XML = null;
             var prevLevel:int = 0;
             var dIdx:int = 0;
             var tempArr:Array = null;
             
             tempArr = _datas[0];
             
             // RootLevel데이터 읽어오기
             var xmlStr:String = "<node label=\""+tempArr[0]+"\" ";
             for(dIdx ; dIdx < _valueCount ; dIdx++)
             {              
              xmlStr += "value"+((dIdx+1)<10?"0"+(dIdx+1):""+(dIdx+1))+"=\""+tempArr[2+dIdx]+"\" ";              
             }
             xmlStr += "/>";
             
             mainXML.appendChild(new XML(xmlStr));
             
             prevLevel = Number(tempArr[1]);
             
//             Debug.trace("ROOT : "+mainXML.toXMLString());
             
             makeXML = mainXML.children()[0];
             
             var tempXML:XML = null;
             for(var idx:int =1 ; idx < dataLen ; idx++)
             {
              tempArr = _datas[idx];
     xmlStr = "<node label=\""+tempArr[0]+"\" ";
              for(dIdx = 0; dIdx < _valueCount ; dIdx++)
              {              
               xmlStr += "value"+((dIdx+1)<10?"0"+(dIdx+1):""+(dIdx+1))+"=\""+tempArr[2+dIdx]+"\" ";              
              }
              xmlStr += "/>";
              
              tempXML = new XML(xmlStr);
              
              if(prevLevel < Number(tempArr[1]))
              { 
               makeXML.appendChild(tempXML);
               prevLevel = Number(tempArr[1]);
               //Debug.trace("A"+idx+","+prevLevel+","+tempArr[1]+":"+makeXML.childIndex()+","+makeXML.children().length());
               makeXML = tempXML;
              }
              else
              {
               if(prevLevel == Number(tempArr[1]))
               {
                makeXML = makeXML.parent();                
               }
               else
               {
                var rLen:int = prevLevel - Number(tempArr[1]) + 1;
                for(var rIdx:int = 0 ; rIdx  < rLen ; rIdx++)
                {
                 makeXML = makeXML.parent();
                }                
               }               
               makeXML.appendChild(tempXML);               
               prevLevel = Number(tempArr[1]);
               //Debug.trace("B"+idx+","+prevLevel+","+tempArr[1]+":"+makeXML.childIndex()+","+makeXML.children().length()+","+makeXML.length());
               makeXML = tempXML;
              }              
             }
             
//             Debug.trace("RSLT : "+mainXML.toXMLString());
             
//             Alert.show("XML","XML만들기");
            }
        ]]>
    </mx:Script>

    <mx:Button label="XML 만들기" click="makeXMLClick()" />
</mx:Application>


뭐... 그냥... 필요할때가 있음.. ㅡ.ㅡ;;
Posted by 이현호
,
Flash & Flex Free Components and Source Files

여기 클릭하세요.

말그대로임....

트랙백이나 위에 클릭해서 가시면됩니다.
Posted by 이현호
,

이것도 역시 Flash enabled Blog에서 퍼왔습니다.

시간순서상으로는 이게 먼저 포스트 된거지만 제가 읽은게 지금이라서.. ^^;;

PS : Trackback이 자꾸 실패나서 홈페이지 Link겁니다.

--> Blog 가기 <--



One cool thing you can do in Flash and Flex, is to create custom classes in order to help you to repeat certain tasks in a easily manner. Today i show you a collection of some cool custom classes, which can help you to develop more and faster.

SoundManager

The SoundManager is a Singleton that does exactly what it says. It has a host of methods to choose from that should make adding sounds to your projects super simple. It has a dependency to TweenLite for the sound fading

Active Window Blur

Blurs a background (MovieClip or Sprite) behind a transparent window (MovieClip or Sprite).

TweenMax

TweenMax builds on top of the TweenLite core class and its big brother, TweenFilterLite, to round out the tweening family with popular (though not essential) features like bezier tweening, pause/resume capabilities, easier sequencing, hex color tweening, and more.

YouTube

A simple light class to connect to the YouTube gdata API and source playlists and featured videos.

Pulse Particles

Pulse Particles is a general purpose AS3 particle system.

Animated Bitmap

The AnimatedBitmap class provides functionality for Bitmap objects that are animated by using a series of still images. When creating a new AnimatedBitmap you provide a BitmapData object that contains an image that consists of the ’single-frame’ images for the animation.

QueueLoader

The QueueLoader is an actionscript library for sequential asset loading and monitoring. QueueLoader is designed to be used with Actionscript 3.0 and has become an open source project. If you are interested in contributing please contact the project leader.

Prioritization

The url prioritization class, it works with Loader, URLLoader, and Sound Objects (and maybe NetStream objects one day). This will let you set a priority for requests so they execute in the right order, take a look at currently executing requests or loading requests.

DistortImage

An updated version of the original DistortImage class for AS2, which allows you to programmatically distort images.

Layout class

This class - rather, a collection of 3: Layout, LayoutConstraint, and LayoutManager - provide that functionality to objects in Flash CS3 through ActionScript 3 using a somewhat similar API (though ActionScript only, no authoring interface). Using these classes you can constrain objects to the top, right, bottom, left, or center them horizontally or vertically within a layout. There are also controls for height and width as well as a property for maintaining aspect ratio.

Color Sampler Class

Color sampling engine for DisplayObjects. Takes a defined sample area (width, height, x, y) of a BitmapData object and computes the average color within the area. The RGB, red channel, green channel, blue channel, hue, saturation, and brightness values are stored from the sample.

2D Character Rigging Classes

The AS 3 rigging classes are used for skelton rigging and skinning of 2D characters. The rigging class library is organized around the development of highly specific articulated rigs. The current focus is on humaniod bipedal characters.

XML Loader Class

AS3 XML loader

StyleCollection

The StyleCollection class lets you create groups of styles that are applied to and automatically updated on subscribing components. It supports both instance and renderer styles (setStyle and setRendererStyle respectively), and uses component introspection to apply only relevant styles to each component. StyleCollection exposes a robust interface, including a static interface that provides global access to named styles.

Easing

Easing is a Singleton that lets you do dynamic point-to-point property tweening. It is able to manipulate virtually any property of any object on or off the stage.

CSSLoader

The class enables you to load CSS files into your flex application during runtime, a functionality Actionscript3.0 lacks.

Autocomplete Text Field

Create an automcplete text field in an AS 3 project.

fZIP

A little Actionscript 3 class that enables you to load standard ZIP archives and extract contained files while the archive is still loading.

Reflection Class

Generate reflections from images


Posted by 이현호
,
에... 맘에 드는 컴포넌트들입니다만... 사실 몇몇개는 회사에서도 유용성에서 생각해본적이
있습니다만.. 코드가 워낙 크다보니 적용에 대하여 보류한적이 있네요..

퍼왔습니다. 밑에 있습니다만 Flash Enabled Blog 에서요..

One of the most searched entries at Flash Enabled Blog is the Flex Calendar. Therefore i decided today to present you a collection of cool Calendars with source available so you can research and customize for your own needs. Feel free to drop a line with your own Flex Calendars and i will make sure to feature them here.

Download source

Download Source

Download Source

Download Source

Download Source


Posted by 이현호
,

... 잘 모르겠음.. AS를 이용하여 뭔가 하는 것임.. ㅡ.ㅡ;;



--> Jump to Blog <--

Posted by 이현호
,
출처 : adobe devnet

Creating BlazeDS channels at runtime

by SujitG on July 10, 2008 Avg Rating 5.0 (1)   |   Log in to rate post.

Tagged with dynamic channels , flex and blazeds , Flex and other technologies , runtime channels

Problem Summary

Usually we create channels in services-config.xml and give URL to channel end points in the same file. In services-config.xml {server.name} and {server.port} tokens are evaluated at runtime, but the {context.root} is not evaluated at runtime. If we have to change the URL along with the web application context root, then we have to re-compile Flex application.

Solution Summary

Solution is simple you will have to create channels on runtime. This is very straight forward and easy. You need not even add your services-config.xml to the compiler arguments.

Explanation

Usually we create channels in services-config.xml and give URL to channel end points in the same file. {server.name} and {server.port} tokens are evaluated at runtime, that is these tokens are replaced based on the URL you are using to access the application. But the {context.root} is not evaluated at runtime. If we have to change the URL along with the web application context root, then we have to re-compile Flex application. It will be great if you can change the end point URL at one location and the Flex application will start using that URL without a need for recompiling the application.

I created a very simple sample application which will access a XML file and then create the channels based on the settings in the configuration file.

XML configurations file with channel details

I created a XML file which has details of the channels which my application has to create. If you see the snippet extracted from the XML file it has definition for AMF channel. In the definition the id is the ID of the channel configured in the services-config.xml file on the server and the endpoint node has the URL to the end point.

Download XML from this URL: ChannelsConfiguration.xml
 
<ChannelsConfig>
<channels>
<channel id=”my-amf”>
<type>amf</type>
<endpoint>http://localhost:9191/lcdssamples/messagebroker/amf</endpoint>
</channel>
</channels>
</ChannelsConfig>
 
Creating Flex application
 
Download MXML file from this URL: DynamicChannels.mxml

Now that I have a XML file with details of the channel my application will be using. I loaded this file when my application starts and create required channels so that my application can communicate with the server for using Remoting/Messaging/Proxy/Data management services provided by LCDS/BlazeDS.

Once the application is created function named loadConfiguration() is invoked which will make a HTTP Service request to get the XML file. Check out the function, it is pretty straightforward HTTP Service call.

When the XML is retrieved I parse the XML file and create channels in the parseConfigurationFile() function. Below are few statements extracted from the parseConfigurationFile() function which are worth explaining

First I create a new channel.
 
_amfChannel = new AMFChannel(channel.@id, channel.endpoint);
 
Next add this channel to the ChannelSet.
 
amfChannelSet = new ChannelSet();
amfChannelSet.addChannel(_amfChannel);
 
That’s it we have created the channel sets which we will be using in the RemoteObject call later. I created more channels

Now that I have the channel sets I need to instruct my RemoteObject to use this channel sets when it is trying to communicate with the server. This is how you do it.

<mx:RemoteObject id=”rmObj” destination=”MySessionHandler”
channelSet=”{amfChannelSet}”
result=”resultHandler(event)”
fault=”faultHandler(event)”
showBusyCursor=”true”/>
 
That is all you need to do. You can invoke operations on RemoteObject as usual. This applies to RemoteObject/Consumer/Producer/DataService
Posted by 이현호
,
결론은 Shared Object를 이용한 Cookie 클래스를 소개하는 겁니다.

--> Jump to Blog <--

필요하다면 한번 봐보시길...
Posted by 이현호
,

출처 : InsideRIA.com

Flex 4 (Gumbo) Available for Download

AddThis Social Bookmark Button

The Flex 4 SDK, code named Gumbo, is up for download now. This is an exciting time for Flex, it's now 2 full versions beyond Flex 2 which was really the first version of Flex that gained mainstream adoption. Adobe is really working hard to get ready for the release of Flash 10 and Thermo. The key goals of the next version of the Flex are:

  1. * Design in Mind: provide a framework meant for continuous collaboration between designer and developer.
  2. * Developer Productivity: improve compiler performance and add productivity enhancements to language features like data binding
  3. * Framework Evolution: take advantage of new Flash Player capabilities and add features required by common use-cases

Ely Greenfield, an engineer from the Flex team has a great overview here:

You can tell it's really start to accommodate the holy grail of the designer developer workflow. I can imagine that they're adding a lot to do the framework to get ready for Thermo also.

Download Flex 4 here and let me know what you think:)

  • comments: 2
Posted by 이현호
,
flex.org 에서 DZone의 최근글들을 보면 잼있는게 가끔 얻어걸립니다.

영어는 짧지만 대강 보면 재미있다는 생각이 드는 것들이 생깁니다.

이번에는 말그대로 트리구조를 화면에 그릴때 Recursion으로 그리는 겁니다.

안타깝게도 소스가 fla 인지라... 제가 뭐라더 설명하기는 어렵네요..

뭐 코드는 대강 이렇다라고 설명이 되어도 그리는 부분이 섞여있거나하면 쥐약인지라.. ㅡ.ㅡ;

Recursion은 재귀호출 정도로 해석되던가요.. 뭐하여간 그런겁니다. 어떤 끝나는 시점의
조건을 만날때까지 자기스스로를 호출하는 것이라고 합니다만....

나머진 구글링 하세요. ^^;;

PS. Recursion Function에 대해서는  n! 을 구하는 예제나 다른 예제 보시기 바랍니다.

--> Programatically Drawing Trees With Recursion <--
Posted by 이현호
,