cairngorm 2.2 의 FDS의 의존성을 제거한 버전 + 오픈리모팅 컴포넌트를 쓰는 환경에서, service.mxml 을 대체하는 클래스를 만들어봤다.
몇일전에 모 카페에 올렸던 글이기도 하다.
NetConnectionEx.as
---------------------------------------------------------
package com.adobe.cairngorm.samples.store.business
{
import flash.net.NetConnection;
import flash.net.ObjectEncoding;
import com.adobe.cairngorm.CairngormError;
import com.adobe.cairngorm.CairngormMessageCodes;
public class NetConnectionEx extends NetConnection
{
private static var instance:NetConnectionEx;
private static var GATEWAY_URL:String = "http://localhost:8080/gateway";
//AS 3.0 은 private 생성자를 지원하지 않는다.아래처럼 캔곰 에러를 발생 시킬수 있지만,
//SingletonEnforcer 클래스를 써서 처리할 수도 있다.
/* public function NetConnectionEx()
{
super();
if ( instance != null )
{
throw new CairngormError( CairngormMessageCodes.SINGLETON_EXCEPTION, "NetConnectionEx" );
}
instance = this;
}
public static function getInstance():NetConnectionEx
{
if ( instance == null )
{
instance = new NetConnectionEx();
}
return instance;
} */
public function NetConnectionEx(enforcer:SingletonEnforcer)
{
super();
}
public static function getInstance():NetConnectionEx
{
if ( instance == null )
{
instance = new NetConnectionEx(new SingletonEnforcer());
instance.objectEncoding = ObjectEncoding.AMF3;
instance.connect(GATEWAY_URL,null);
}
return instance;
}
}
}
class SingletonEnforcer{}
'openamf'에 해당되는 글 1건
- 2007/05/22 iamyhs cairngorm 2.2 의 Services.mxml 을 대체하는 NetConnectionEx 클래스

댓글을 달아 주세요
댓글 RSS 주소 : http://iamyhs.com/tc/rss/comment/69