Page 1 of 1

SmartFoxBits without MXML (AS3 project)

Posted: 13 Jul 2011, 18:09
by Damace
Can I use SmartFoxBits is a pure AS3 project?

I tried to make a simple app just to get the connector working:

Code: Select all

package
{
   import com.smartfoxserver.smartfoxbits.bits.Connector;
   import flash.display.Sprite;

   public class SmartFoxBits extends Sprite
   {
      public var connector:Connector = new Connector();
      
      public function SmartFoxBits()
      {
         connector.x = stage.stageWidth / 2;
         connector.y = stage.stageHeight / 2;

         addChild(connector);
         connector.connect();
      }
   }
}


But an error pops up saying something with the constructor of Connector is wrong:

Code: Select all

Error: No class registered for interface 'mx.styles::IStyleManager2'.
at mx.core::Singleton$/getInstance()[E:\dev\hero_private\frameworks\projects\framework\src\mx\core\Singleton.as:111]
at mx.styles::StyleManager$/get impl()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\styles\StyleManager.as:78]
at mx.styles::StyleManager$/getStyleDeclaration()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\styles\StyleManager.as:187]
at com.smartfoxserver.smartfoxbits.bits::Connector$/classConstruct()[/Users/Paolo/gotoAndPlay/gotoAndPlay/SmartFoxServer2X/SmartFoxBits/Flex/Base Pack/source/src/com/smartfoxserver/smartfoxbits/bits/Connector.as:302]
at com.smartfoxserver.smartfoxbits.bits::Connector$cinit()
at global$init()[/Users/Paolo/gotoAndPlay/gotoAndPlay/SmartFoxServer2X/SmartFoxBits/Flex/Base Pack/source/src/com/smartfoxserver/smartfoxbits/bits/Connector.as:135]
at SmartFoxBits()[/Users/Damace/Dropbox/Projects/Game Dev/SmartFoxBits/src/SmartFoxBits.as:11]


From the look of this error I guess that he is looking for some MXML class that he can't find in an AS3 project.

Posted: 14 Jul 2011, 10:02
by Bax
The SmartFoxBits for Flex use the mx UI framework classes, so you should extend the Application class at least.
This link can provide additional informations: http://www.actionscript.org/forums/showthread.php3?t=181945
What about using the Flash version of the Bits?