I'm using FlashDevelop. I created a new project and connect it to a file connector.as who took the example. Added the sfs2x_api_as3.swc library. But when i try to compile this project, i get a "Type was not found or was not a compile-time constant: SFSEvent".
For example, here:
private function onConnection(evt:SFSEvent):void
{
if (evt.params.success)
{
dTrace("Connection Success!")
}
else
{
dTrace("Connection Failure: " + evt.params.errorMessage)
}
}
Has anyone encountered this problem?
Error: SFSEvent not found
Re: Error: SFSEvent not found
Did you import the class in your code?
Thanks
Thanks
Re: Error: SFSEvent not found
yes. Here are the contents of the file Main.as:
the class Connector.as is taken from the example:
the only change is that sfs.loadConfig() called immediately, rather than clicking on the button
sfs2x_api_as3.swc added to the library
Code: Select all
package
{
import flash.display.Sprite;
import flash.events.Event;
public class Main extends Sprite
{
private var con:Connector = new Connector();
public function Main()
{
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event = null):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
// entry point
addChild(con);
}
}
}
the class Connector.as is taken from the example:
Code: Select all
/**
* SmartFoxServer 2X Examples: Connector
*
* (c) 2009 - 2011 gotoAndPlay()
*/
package
{
import com.smartfoxserver.v2.SmartFox
import com.smartfoxserver.v2.core.SFSEvent
import com.smartfoxserver.v2.entities.*
import com.smartfoxserver.v2.entities.data.*
import com.smartfoxserver.v2.requests.*
import flash.display.*
import flash.events.*
import flash.system.Security
public class Connector extends Sprite
{
private var sfs:SmartFox
public function Connector()
{
// Create an instance of the SmartFox class
sfs = new SmartFox()
// Turn on the debug feature
sfs.debug = true
// Add SFS2X event listeners
sfs.addEventListener(SFSEvent.CONNECTION, onConnection)
sfs.addEventListener(SFSEvent.CONNECTION_LOST, onConnectionLost)
sfs.addEventListener(SFSEvent.CONFIG_LOAD_SUCCESS, onConfigLoadSuccess)
sfs.addEventListener(SFSEvent.CONFIG_LOAD_FAILURE, onConfigLoadFailure)
sfs.loadConfig()
}
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// SFS2X event handlers
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
private function onConnection(evt:SFSEvent):void
{
if (evt.params.success)
{
dTrace("Connection Success!")
}
else
{
dTrace("Connection Failure: " + evt.params.errorMessage)
}
}
private function onConnectionLost(evt:SFSEvent):void
{
dTrace("Connection was lost. Reason: " + evt.params.reason)
}
private function onConfigLoadSuccess(evt:SFSEvent):void
{
dTrace("Config load success!")
dTrace("Server settings: " + sfs.config.host + ":" + sfs.config.port)
}
private function onConfigLoadFailure(evt:SFSEvent):void
{
dTrace("Config load failure!!!")
}
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// Utility methods
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
private function dTrace(msg:String):void
{
trace("--> " + msg);
}
}
}
the only change is that sfs.loadConfig() called immediately, rather than clicking on the button
sfs2x_api_as3.swc added to the library
Re: Error: SFSEvent not found
Since this is a compile time problem I would suggest to download the latest API from here:
http://www.smartfoxserver.com/download/sfs2x#p=client
and try again. It sounds like your SWC might be corrupted.
Thanks
ps. = I've haven't used FlashDevelop in a long time but I recall it allowed to inspect the content of imported SWCs.
Once you have downloaded the API you can double check that FD sees the classes correctly.
http://www.smartfoxserver.com/download/sfs2x#p=client
and try again. It sounds like your SWC might be corrupted.
Thanks
ps. = I've haven't used FlashDevelop in a long time but I recall it allowed to inspect the content of imported SWCs.
Once you have downloaded the API you can double check that FD sees the classes correctly.
Re: Error: SFSEvent not found
When connected a new version of the API error occurs in the SWC library: "Error: version required to extract this entry not supported (788)".
Here in the forum I have found a solution to this problem related to the fact that in the new version included a library and documentation If you change the extension to .zip, and then back up again, and change the extension to the .swc, the error will go away. (http://www.smartfoxserver.com/forums/viewtopic.php?f=19&t=13538)
It is true, the error disappears and classes are available, but the previous error: "Type was not found or was not a compile-time constant: SFSEvent" remains
Here in the forum I have found a solution to this problem related to the fact that in the new version included a library and documentation If you change the extension to .zip, and then back up again, and change the extension to the .swc, the error will go away. (http://www.smartfoxserver.com/forums/viewtopic.php?f=19&t=13538)
It is true, the error disappears and classes are available, but the previous error: "Type was not found or was not a compile-time constant: SFSEvent" remains
Re: Error: SFSEvent not found
Maybe Flash Develop doesn't work well with SWC files containing the doc?
If you want I can send you the SWC without any doc. Do you want me to use the email in your User profile?
If you want I can send you the SWC without any doc. Do you want me to use the email in your User profile?
Re: Error: SFSEvent not found
Yes please. I would be grateful. Thank you.
Re: Error: SFSEvent not found
Sent,
let us know if it helps.
let us know if it helps.
Re: Error: SFSEvent not found
Thank you, but unfortunately it did not help
Re: Error: SFSEvent not found
Sounds very odd.
I would try installing a fresh copy of Flash Develop, possibly on a different machine, and try there.
I would try installing a fresh copy of Flash Develop, possibly on a different machine, and try there.
Re: Error: SFSEvent not found
I have is the latest version FlashDevelop. The most interesting thing is that the problem arises when you try to create a class SFS2X (in my case the "Сonnector"). If not created it, then the project is started normally. If instead of SFS2X use SFS Pro, the project is started again normal.
Re: Error: SFSEvent not found
The problem was solved updating sdk and Flash Player Thank you for helping
Re: Error: SFSEvent not found
How weird
Well... good to know. Cheers!
Well... good to know. Cheers!
Return to “SFS2X ActionScript 3 API”
Who is online
Users browsing this forum: No registered users and 27 guests