I have Flex 3.6A + BlazeDS + java6 webapp.
I want to push message from server that must be intercepted by the client (.mxml page). Googlin around I manage to build the follow example:
public class TestMessaging extends ServiceAdapter {
private String previousMsg = "";
private volatile boolean running;
private Message createTestMessage() {
AsyncMessage msg = new AsyncMessage();
msg.setDestination("RandomDataPush");
msg.setClientId(UUIDUtils.createUUID());
msg.setMessageId(UUIDUtils.createUUID());
msg.setBody(BarValues.STATUS);
return msg;
}
#Override
public void start(){
super.start();
Thread messageSender = new Thread(){
public void run(){
running = true;
while(running){
sendMessageToClients(createTestMessage());
secondsToSleep(3);
}
}
};
messageSender.start();
}
/**
* #see flex.messaging.services.ServiceAdapter#stop()
*/
#Override
public void stop(){
super.stop();
running = false;
}
public void sendMessageToClients(Message msg) {
if (!msg.getBody().equals(previousMsg)) {
previousMsg = msg.getBody().toString();
((MessageService) getDestination().getService()).pushMessageToClients(msg, false);
}
}
#Override
public Object invoke(Message message) {
if (message.getBody().equals("stop")) {
running = false;
} else if (message.getBody().equals("start")) {
start();
}
return null;
}
private void secondsToSleep(int seconds) {
try{
Thread.sleep(seconds * 1000);
}catch(InterruptedException e){
System.out.println("TestServiceAdapter Interrupted while sending messages");
e.printStackTrace();
}
}
}
In the .mxml I have:
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="100%" height="100%" creationComplete="init()">
<mx:Script>
<![CDATA[
private function messageHandler(message:IMessage):void {
randomNumbers = message.body as String;
if (randomNumbers == null) {
var msg:AsyncMessage = new AsyncMessage();
msg.body = "stop";
producer.send(msg);
} else Alert.show(randomNumbers.toString());
}
private function init():void {
var msg:AsyncMessage = new AsyncMessage();
msg.body = "stop";
producer.send(msg);
consumer.subscribe();
}
private function start():void {
var msg:AsyncMessage = new AsyncMessage();
msg.body = "start";
producer.send(msg);
consumer.subscribe();
}
private function handleFault(event:MessageFaultEvent):void {
Alert.show(event.faultString);
}
private function ack(event:MessageAckEvent):void {
if (event.message.body != null) {
randomNumbers = event.message.body as String;
Alert.show(randomNumbers.toString());
}
}
<mx:Producer id="producer" destination="RandomDataPush" acknowledge="ack(event)"/>
<mx:Consumer id="consumer" destination="RandomDataPush" message="messageHandler(event.message)" />
</mx:Application>
Problems are:
1) Whitout a thread I can't manage to push messages
2) The thread starts automatically when I alunch the application. To prevent this I send the "stop" when the init() method of the flex page is called (but is really orrible)
What I want to do is: when a java query is executed (or a complex elaboration starts) I want to start the service and send messages calling manually the sendMessageToClients method (without thread if is it possible) and, when the query or the elaboration ends, stop the service.
Can you help me?
Thanks all
Related
I'm trying to use Topshelf Framework to create a windows service. But when i try to start the service, there is this exception :
" The service failed to start... System.Service.Process.TimeoutException : the waiting period has expired and the operation has not been completed"
This is my code :
public class MyService : ServiceControl
{
private System.Timers.Timer _timer;
public void MyService()
{
_timer = new System.Timers.Timer(10);
_timer.AutoReset = false;
_timer.Elapsed += new ElapsedEventHandler(TimerOnElapsed);
}
private void TimerOnElapsed(object source, ElapsedEventArgs e)
{
//all the operation to do at the startup
}
public bool Start(HostControl hostControl)
{
_timer.Start();
return true;
}
public bool Stop(HostControl hostControl)
{
_timer.Stop();
return true;
}
}
Thanks for any help :)
There are several issues I notice:
The current code would make the timer fire only once (you have AutoReset = false)
with TopShelf, the MyService class should look like this:
using System.Timers;
using Topshelf;
namespace TopShelfTestService
{
public class MyService
{
private System.Timers.Timer _timer;
public MyService()
{
_timer = new System.Timers.Timer(10);
_timer.AutoReset = true;
_timer.Elapsed += new ElapsedEventHandler(TimerOnElapsed);
}
private void TimerOnElapsed(object source, ElapsedEventArgs e)
{
//all the operation to do at the startup
}
public bool Start(HostControl hostControl)
{
_timer.Start();
return true;
}
public bool Stop(HostControl hostControl)
{
_timer.Stop();
return true;
}
}
}
and the console app/ Program.cs will look like so:
using Topshelf;
namespace TopShelfTestService
{
class Program
{
static void Main(string[] args)
{
HostFactory.Run(x =>
{
x.Service<MyService>(s =>
{
s.ConstructUsing(name => new MyService());
s.WhenStarted((tc, hostControl) => tc.Start(hostControl));
s.WhenStopped((tc, hostControl) => tc.Stop(hostControl));
});
x.RunAsLocalSystem();
x.SetDescription("Sample Topshelf Host"); //7
x.SetDisplayName("Test Service with TopShelf"); //8
x.SetServiceName("TopShelfTestService");
});
}
}
}
First.mxml - Contains a Datefield control as follows:
<mx:DateField id="G2_CRTLoadDate" width="150" selectedDate="{modelProxy.G2_CRTLoadDate}" change="{modelProxy.G2_CRTLoadDate = event.currentTarget.selectedDate;changeManagerStatus()}"/>
I'm assigning this Datefield value to a static variable CERT_LOAD_DATE as follows(First.mxml):
[Bindable]
public static var CERT_LOAD_DATE:String = "";
private function changeManagerStatus():void
{
CERT_LOAD_DATE = G2_CRTLoadDate.selectedDate.toDateString();
}
Second.mxml -Here, I have a Combobox as follows:
<mx:ComboBox id="General_Release_Dates"
selectedItem="{modelProxy.General_Release_Dates}"
valueCommit="{model.General_Release_Dates = event.currentTarget.selectedItem;updateReleaseDate(event)}"
change="{model.General_Release_Dates = event.currentTarget.selectedItem;updateReleaseDate(event)}" close="closeHandler(event);" includeInLayout="true" visible="true">
</mx:ComboBox>
Inside the closeHandler function, I'm trying to access the variable CERT_LOAD_DATE as follows:
private function closeHandler(evt:DropdownEvent):void {
var CurrentDate:Date = new Date();
if(General_Release_Dates.selectedLabel.toString() == "TBD")
{
Alert.show(First.CERT_LOAD_DATE);
}
}
The alert box displays no value (null). Please help.
I can't figure out the relationship between First.mxml and Second.mxml from your question.
However, the following code can't access First.mxml.
Alert.show(First.CERT_LOAD_DATE);
Because the "First" is not the same instance as loaded "First.mxml".
How about to use singleton? It's accessible from anywhere.
1st, add MySingleton.as class like this.
package foo.bar
{
public class MySingleton
{
private var _cert_load_date:String;
public function MySingleton(internally:SingletonInternal)
{
super();
if(internally == null)
{
throw new Error("Please use getInstance() method.");
}
}
public static function getInstance():MySingleton
{
return SingletonInternal.instance;
}
public function set cert_load_date(value:String):void
{
_cert_load_date = value;
}
public function get cert_load_date():String
{
return _cert_load_date;
}
}
}
import foo.bar.MySingleton;
class SingletonInternal{
public static var instance:MySingleton
= new MySingleton(new SingletonInternal());
public function SingletonInternal(){}
}
How to use
Set value at First.mxml.
public var singleton: MySingleton = MySingleton.getInstance();
private function changeManagerStatus():void
{
singleton.cert_load_date = G2_CRTLoadDate.selectedDate.toDateString();
}
Second.mxml
public var singleton: MySingleton = MySingleton.getInstance();
private function closeHandler(evt:DropdownEvent):void {
var CurrentDate:Date = new Date();
if(General_Release_Dates.selectedLabel.toString() == "TBD")
{
Alert.show(singleton.cert_load_date);
}
}
Updated: Aug 27 10:00(JST)
I think there are two way to change First.mxml's element using singleton.
1) Binding the DateField value to singleton variables, and clear the value at Secend.mxml.
2) Assign to singleton variables whole "First", and control from Second.mxml.
I'll write here the 2nd way.
If you use this way, anything is controlable from Second.mxml.
MySingleton.as
private var _first:Object;
public function set first(value:Object):void
{
_first = value;
}
public function get first():Object
{
return _first;
}
First.mxml
singleton.first = this;
Second.mxml
public function something(): void{
First(singleton.first).G2_CRTLoadDate.selectedDate = null;
// The cast is unnecessary. Following code also works.
// singleton.first.G2_CRTLoadDate.selectedDate = null;
}
Also you can execute First.mxml's public function from Second.mxml.
singleton.first.someFunctionDefinedAtFirst();
I am working on a Action Script project and no matter what I did I wasn't able to get a texture from a Atlas, in the end I had to do some quick changes that I rather not keep. Does anyone know why I cannot get a texture from the createDiabloCrashArt method with this:
package gameObjects
{
import starling.core.Starling;
import starling.display.Image;
import starling.display.MovieClip;
import starling.display.Sprite;
import starling.events.Event;
import starling.utils.deg2rad;
public class Diablo extends Sprite
{
private var _type:int;
private var _speed:int;
private var _distance:int;
private var _alreadyHit:Boolean;
private var _position:String;
private var _hitArea:Image;
private var diabloImage:Image;
private var diabloAnimation:MovieClip;
private var diabloCrashImage:Image;
public function Diablo(_ptype:int, _pdistance:int)
{
super();
this._type = _ptype;
this._distance = _pdistance;
this._speed = GameConstants.DIABLO_SPEED;
_alreadyHit = false;
this.addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
}
private function onAddedToStage(e:Event):void
{
this.removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
createDiabloArt();
}
private function createDiabloArt():void
{ //Gets some other stuff using the same getAtlas but as MovieAnimation and works.
}
private function createDiabloCrashArt():void
{
// trace("diablo_chingo" + _type + "KO");
if (diabloCrashImage == null)
{
diabloCrashImage = new Image(Assets.getAtlas().getTexture("diablo_chingo" + _type + "KO"));
this.addChild(diabloCrashImage);
}
else
{
diabloCrashImage.texture = Assets.getAtlas().getTexture("diablo_chingo" + _type + "KO");
}
diabloCrashImage.visible = false;
}
private function hidePreviousInstance():void
{
if (diabloAnimation != null && _type <= GameConstants.DIABLO_TYPE_4)
{
diabloAnimation.visible = false;
Starling.juggler.remove(diabloAnimation);
}
if (diabloImage != null) diabloImage.visible = false;
}
public function get type():int { return _type; }
public function set type(value:int):void
{
_type = value;
resetForReuse();
hidePreviousInstance();
createDiabloArt();
}
public function get alreadyHit():Boolean { return _alreadyHit; }
public function set alreadyHit(value:Boolean):void
{
_alreadyHit = value;
if (value)
{
diabloCrashImage.visible = true;
if (_type >= GameConstants.DIABLO_TYPE_1 || _type <= GameConstants.DIABLO_TYPE_4)
{
diabloAnimation.visible = false;
}
else
{
diabloImage.visible = false;
Starling.juggler.remove(diabloAnimation);
}
}
}
public function resetForReuse():void
{
this.alreadyHit = false;
this.rotation = deg2rad(0);
}
}
}
But it works by changing the following things:
private function onAddedToStage(e:Event):void
{
this.removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
createDiabloArt();
createDiabloCrashArt();
}
private function createDiabloCrashArt():void
{
// trace("diablo_chingo" + _type + "KO");
if (diabloCrashImage == null)
{
diabloCrashImage = new Image(Assets.getTexture("Diablo1"));
this.addChild(diabloCrashImage);
}
else
{
diabloCrashImage.texture = Assets.getTexture("Diablo1");
//Assets.getAtlas().getTexture("diablo_chingo" + _type + "KO");
}
diabloCrashImage.visible = false;
}
I verified time and time again with debugger, trace and the like that the right parameters where reaching the function such as _type, as a matter of fact in the long method that I didn't include getting the texture I need using the above syntax worked wonderfully.
I tried to:
Change Image to MovieClip
Initialize before getting to createCrashArt
Getting other textures like the ones I can already display (didn't work)
Staring at it really hard.
Setting a default string for the texture.
None yielded anything until I changed the code to look like in the second snippet, the thing is that I don't get why it didn't work and I rather not depend on a quick fix that may or may not turn into a setback later.
Seriously any help to understand this would be great. I don't even care that ir is working right now I just can't for the life of me figure what was wrong in the first place.
Thanks in advance.
EDIT:
public static function getAtlas():TextureAtlas
{
if (gameTextureAtlas == null)
{
var texture:Texture = getTexture("AtlasTextureGame");
var xml:XML = XML(new AtlasXmlGame());
gameTextureAtlas=new TextureAtlas(texture, xml);
}
return gameTextureAtlas;
}
/**
* Returns a texture from this class based on a string key.
*
* #param name A key that matches a static constant of Bitmap type.
* #return a starling texture.
*/
public static function getTexture(name:String):Texture
{
if (gameTextures[name] == undefined)
{
var bitmap:Bitmap = new Assets[name]();
gameTextures[name]=Texture.fromBitmap(bitmap);
}
//trace("Tomando textura!");
return gameTextures[name];
}
EDIT: Assets class
package
{
import flash.display.Bitmap;
import flash.utils.Dictionary;
import starling.textures.Texture;
import starling.textures.TextureAtlas;
public class Assets
{
/**
* Atlas de texturas.
*/
[Embed(source="../Witchmedia/graphics/Spritesheet/ScarletWitch.png")]
public static const AtlasTextureGame:Class;
[Embed(source="../Witchmedia/graphics/Spritesheet/ScarletWitch.xml", mimeType="application/octet-stream")]
public static const AtlasXmlGame:Class;
/**
* Assets de Fondo y botones.
*/
[Embed(source="../Witchmedia/graphics/bgLayer3.jpg")]
public static const BgLayer1:Class;
[Embed(source="../Witchmedia/graphics/Diablo1.png")]
public static const Diablo1:Class;
/**
* Cache de Texturas
*/
private static var gameTextures:Dictionary = new Dictionary();
private static var gameTextureAtlas:TextureAtlas;
/**
* Returna una instancia del atlas de texturas.
* #return the TextureAtlas instance (Singleton)
*/
public static function getAtlas():TextureAtlas
{
if (gameTextureAtlas == null)
{
var texture:Texture = getTexture("AtlasTextureGame");
var xml:XML = XML(new AtlasXmlGame());
gameTextureAtlas=new TextureAtlas(texture, xml);
}
return gameTextureAtlas;
}
/**
* Returns a texture from this class based on a string key.
*
* #param name A key that matches a static constant of Bitmap type.
* #return a starling texture.
*/
public static function getTexture(name:String):Texture
{
if (gameTextures[name] == undefined)
{
var bitmap:Bitmap = new Assets[name]();
gameTextures[name]=Texture.fromBitmap(bitmap);
}
//trace("Tomando textura!");
return gameTextures[name];
}
}
Can you check with this method, Give the texture declaration in a separate class, i guess it doesnt take the appropriate texture.
public static function getAtlas(atlasNumb:uint = 1):TextureAtlas
{
if(sTextureAtlas[atlasNumb - 1] == null)
{
var texture:Texture = getTexture("AtlasTexture"+atlasNumb);
var xml:XML = XML(create("AtlasXml"+atlasNumb));
sTextureAtlas[atlasNumb-1] = new TextureAtlas(texture, xml);
}
return sTextureAtlas[atlasNumb - 1];
}
private static function create(name:String):Object
{
var textureClass:Class = AssetEmbeds_2x;
return new textureClass[name];
}
And define the textures .png and xml in a separate file called AssetEmbeds_2x.
while calling the texture define like
Assets.getAtlas(1).getTextures("xxx"). I hope it wll
I Implement IList interface like
[Bindable]
public class MemList implements IList
{
public function MemList()
{
}
public function get length():int
{
var size:int = 5000;
return size;
}
public function addItem(item:Object):void
{
}
public function addItemAt(item:Object, index:int):void
{
}
public function getItemAt(index:int, prefetch:int=0):Object
{
var obj:Object = new Object();
obj.value = ByteStr(); // this function return a string
return obj;
}
public function getItemIndex(item:Object):int
{
return 0;
}
public function itemUpdated(item:Object, property:Object=null, oldValue:Object=null, newValue:Object=null):void
{
}
public function removeAll():void
{
}
public function removeItemAt(index:int):Object
{
return null;
}
public function setItemAt(item:Object, index:int):Object
{
return null;
}
public function toArray():Array
{
return null;
}
public function addEventListener(type:String, listener:Function, useCapture:Boolean=false, priority:int=0, useWeakReference:Boolean=false):void
{
}
public function removeEventListener(type:String, listener:Function, useCapture:Boolean=false):void
{
}
public function dispatchEvent(event:Event):Boolean
{
return false;
}
public function hasEventListener(type:String):Boolean
{
return false;
}
public function willTrigger(type:String):Boolean
{
return false;
}
}
and provide its object to DataGroup as data provider, In Mxml file I am doing this
<fx:Script><![CDATA[
[Bindable]private var list:MemList = new MemList();
protected function onBtnShow(event:MouseEvent):void
{
send(somenumber, MAX_SIZE, onShowResp);//get data from network
}
private function onShowResp(retVal:uint, ba:ByteArray):void
{
//this function called when ba bytearray is filled with data.
}
]]></fx:Script>
<s:Button id="btnShow" label="Show" click="onBtnShow(event)"/>
<s:Scroller verticalScrollPolicy="auto" id="aScroller"
liveScrolling="false">
<s:DataGroup id="dgMemView" width="100%" height="350"
dataProvider="{list}"
clipAndEnableScrolling="true"
itemRenderer="ItemRenderer"
>
<s:layout>
<s:VerticalLayout useVirtualLayout="true"/>
</s:layout>
</s:DataGroup>
</s:Scroller>
public function ByteStr(loc:uint):String
{
//this function can access ba bytearray filled with data. do some processing
on that data and return a string.
return string;
}
My question is when application run data group does not show anything because there is no data in the ba (bytearray) that must be filled with network data. when I press show button it makes a request and fills ba (bytearray) with data. how can I notify Datagroup that data has been changed. I am using flash builder 4.5. Thanks
You need to dispatch appropriate collectionChange event. See docs at http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/collections/IList.html#event:collectionChange
I'm trying to use the Facebook Actionscript graph api but I seem to be having problems in IE (other browsers like chrome and firefox seem okay so far).
From what i can tell, it's logging in fine and returning the user id but when i do a lookup on that user with Facebook.api(_user, handleUserRequest); I get an error.
Is there any known problems with the Facebook Actionscript graph api that affects IE only?
thanks
ob
Per request - the error is as follows:
[IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: https://graph.facebook.com/100002210990429?access%5Ftoken=205690086123032%7C2%2EUzvN3mFr07kPAecZ7qN1Rg%5F%5F%2E3600%2E1303135200%2E1%2D100002210990429%7Cz9L%5Fc26QKCc6cs2g5FClG%5FBsoZg"]
This if this url is pasted into chrome it works just fine, but IE returns 'unable to download XXXXXXXX from graph.facebook.com'
best
obie
the code that I'm using is as follows:
package com.client.facebookgame.services
{
import com.client.facebookgame.services.events.FacebookServiceEvent;
import com.facebook.graph.data.FacebookSession;
import com.facebook.graph.Facebook;
import flash.events.Event;
import flash.events.EventDispatcher;
import flash.events.TimerEvent;
import flash.external.ExternalInterface;
import flash.net.URLRequestMethod;
import flash.utils.Timer;
import uk.co.thereceptacle.utils.Debug;
/**
* Facebook Service
*/
public class FacebookService extends EventDispatcher
{
// constants
public static const API_KEY : String = "XXXXXX";
public static const PERMISSIONS : String = "read_stream,publish_stream,user_likes";
public static const FB_REDIRECT_URL : String = "http://apps.facebook.com/appname/";
public static const LOGGED_IN : String = "loggedin";
public static const LOGGED_IN_ON_FB : String = "loggedinonfacebook";
public static const LOGGED_OUT : String = "loggedout";
public static const LOGGED_OUT_ON_FB : String = "loggedoutonfacebook";
public static const TIMEOUT_COUNT : int = 10;
public static const TIMER_DELAY : int = 3 * 1000;
// properties
private var _user : String;
private var _topUrl : String;
private var _currentState : String;
private var _timer : Timer;
private var _timerCount : int;
public var postObject : Object;
// constuctor
public function FacebookService()
{
if (ExternalInterface.available) _topUrl = ExternalInterface.call("top.location.toString");
Debug.log("facebook init", this);
Facebook.init(API_KEY, handleLogin);
startTiming();
currentState = _topUrl ? LOGGED_OUT : LOGGED_OUT_ON_FB;
}
// methods
public function login():void
{
Facebook.login(handleLogin, { perms: PERMISSIONS } );
}
public function logout():void
{
Facebook.logout(handleLogout);
}
public function selectUserFriendsWithAppRequestDialogue(message:String, dialogueType:String = "iframe", optionalPostObject:Object = null):void
{
this.postObject = optionalPostObject;
Facebook.ui("apprequests", { message:message }, handleAppRequest, dialogueType);
}
public function checkIfUserLikesApp():void
{
Facebook.api(_user + "/likes", handleLikes);
}
private function startTiming():void
{
if (_timer) clearTimer();
_timer = new Timer(TIMER_DELAY, TIMEOUT_COUNT);
_timer.addEventListener(TimerEvent.TIMER, handleTimerEvents);
_timer.addEventListener(TimerEvent.TIMER_COMPLETE, handleTimerEvents);
_timer.start();
}
private function clearTimer():void
{
_timer.stop();
_timer.removeEventListener(TimerEvent.TIMER, handleTimerEvents);
_timer.removeEventListener(TimerEvent.TIMER_COMPLETE, handleTimerEvents);
_timer = null;
_timerCount = 0;
}
// event handlers
private function handleLogin(success:Object, fail:Object):void
{
if (_timer) clearTimer();
if (success)
{
Debug.log(success, this);
_user = success.uid;
currentState = _topUrl ? LOGGED_IN : LOGGED_IN_ON_FB;
Facebook.api("/" + _user, handleGetUser);
}
else if (!success && !_topUrl)
{
ExternalInterface.call("redirect", API_KEY, PERMISSIONS, FB_REDIRECT_URL);
}
}
private function handleGetUser(success:Object, fail:Object):void
{
Debug.log(success + ", " + fail, this);
if (success) dispatchEvent(new FacebookServiceEvent(FacebookServiceEvent.GET_USER_COMPLETE, success));
else dispatchEvent(new FacebookServiceEvent(FacebookServiceEvent.GET_USER_FAIL, fail, true));
}
private function handleAppRequest(result:Object):void
{
if (postObject)
{
for (var i:int = 0; i < result.request_ids.length; i++)
{
var requestID:String = result.request_ids[i];
Facebook.api("/" + requestID, handleRequestFriends);
}
}
}
private function handleRequestFriends(success:Object, fail:Object):void
{
if (success)
{
var friendID:String = success.to.id;
Facebook.api("/" + friendID + "/feed", handleSubmitFeed, postObject, URLRequestMethod.POST);
}
else
{
Debug.log(fail, this);
}
}
private function handleLikes(success:Object, fail:Object):void
{
if (success)
{
for (var i:int = 0; i < success.length; i++)
{
Debug.log("compare " + success[i].id + " with key: " + API_KEY, this);
if (success[i].id == API_KEY)
{
Debug.log("found that user liked this app!!!", this, true);
dispatchEvent(new FacebookServiceEvent(FacebookServiceEvent.USER_LIKES_APP, { userLikesApp:true } ));
return;
}
}
dispatchEvent(new FacebookServiceEvent(FacebookServiceEvent.USER_LIKES_APP, { userLikesApp:false } ));
}
else
{
Debug.log(fail, this, true);
}
}
private function handleLogout(obj:*):void
{
currentState = _topUrl ? LOGGED_OUT : LOGGED_OUT_ON_FB;
}
private function handleSubmitFeed(success:Object, fail:Object):void
{
if (success) dispatchEvent(new FacebookServiceEvent(FacebookServiceEvent.FEED_SUBMITTED, success));
else dispatchEvent(new FacebookServiceEvent(FacebookServiceEvent.FEED_FAIL, fail, true));
}
private function handleTimerEvents(e:TimerEvent):void
{
switch (e.type)
{
case TimerEvent.TIMER :
_timerCount ++;
Debug.log("facebook init attempt " + _timerCount, this);
Facebook.init(API_KEY, handleLogin);
break;
case TimerEvent.TIMER_COMPLETE :
clearTimer();
dispatchEvent(new FacebookServiceEvent(FacebookServiceEvent.GET_USER_FAIL));
break;
}
}
// accessors / mutators
public function get currentState():String { return _currentState; }
public function set currentState(value:String):void
{
if (_currentState != value)
{
_currentState = value;
dispatchEvent(new FacebookServiceEvent(FacebookServiceEvent.STATE_UPDATE));
}
}
}
}
Thanks very much
ob
i found the answer on the facebook actionscript issues list:
http://code.google.com/p/facebook-actionscript-api/issues/detail?id=197
I was also trying to find a solution
but the only one is to publish it with
flash player 10
fixed the problem for me
I was facing same issue.Main reason of this issue is Flash Player version.
Use Flash Player 10+ FaceBookGraphApi SWC file is compatible with Flash Player 10.
This solution is only for who are using swc from GraphAPI_Examples_1_6_1