Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - AGDkatta

Pages: 1
Ask a Question / Load SWF
« on: August 14, 2013, 12:52:32 am »
I want put swf file in my game
There are a maximum sire for this?
Why the code doesn't work correcly?

package scripts
   import flash.display.Loader;
   import flash.utils.ByteArray;
   import flash.display.MovieClip;
   import stencyl.api.engine.*;
   import stencyl.api.engine.behavior.*;
   import stencyl.api.engine.scene.*;
   import org.flixel.*;
   import flash.display.BitmapData;
   import flash.display.Bitmap;
   public dynamic class loadSWF extends SceneScript
      [Attribute(id="1", name="SWF X", desc="The X coordinate of the SWF.")]
      public var _swfX:Number;
      [Attribute(id="2", name="SWF Y", desc="The Y coordiinate of the SWF.")]
      public var _swfY:Number;
      [Attribute(id="3", name="Next Scene", desc="The scene to switch to when the SWF finishes playing.")]
      public var _nextScene:Scene;
      [Attribute(id="4", name="Fade Out Time", desc="The fade out time for this scene in seconds.")]
      public var _fadeOutTime:Number;
      [Attribute(id="5", name="Fade In Time", desc="The fade in time for the next scene in seconds.")]
      public var _fadeInTime:Number;
      [Attribute(id="6", name="Website URL", desc="The website to open when the mouse is clicked. Must be the full URL (e.g.")]
      public var _websiteURL:String;
      [Attribute(id="10", name="Automatic Scaling?", desc="Should the SWF scale to fit the screen? Overrides the manual settings below if checked.")]
      public var _autoScale:Boolean;
      [Attribute(id="8", name="Scale X", desc="Scales the X of the SWF by this amount. Use decimal values (e.g. .5 = 50%).")]
      public var _scaleX:Number;
      [Attribute(id="7", name="Scale Y", desc="Scales the Y of the SWF by this amount. Use decimal values (e.g. .5 = 50%).")]
      public var _scaleY:Number;
      [Attribute(id="9", name="Maintain Ratio?", desc="Should auto-scaling maintain the correct ratio?")]
      public var _maintainRatio:Boolean;
      [Attribute(id="12", name="Advance automatically?", desc="Should the behavior try to advance to the next scene by detecting the end of the SWF? Overrides the manual setting below if checked.")]
      public var _advanceAutomatically:Boolean;
      [Attribute(id="11", name="Scene Switch Delay", desc="If Advance Automatically is not used, switch the scene after this time.")]
      public var _switchDelay:Number;
      [Attribute(id="14", name="Auto-adjust FPS?", desc="Attempt to detect the FPS of the SWF and match it automatically. Overrides the manual setting below if checked.")]
      public var _autoFPS:Boolean;
      [Attribute(id="13", name="FPS of the SWF", desc="Sets the FPS of the stage manually. Use this if the auto-adjust setting above doesn't work.")]
      public var _manualFPS:Number;

      // ***** Place the path to your SWF here. Be sure to use / not \! *****
      [Embed(source="/Users/lorenzocattaneo/Desktop/Kami/Logo/Logo Animato/Logo.swf", mimeType="application/octet-stream")]
      var mySWF:Class;

      var swfLoader:Loader = new Loader();      
      var currentSWF:MovieClip = new MovieClip();
      var swfFrameRate:Number;
      var stencylFrameRate:Number = FlxG.stage.frameRate;
      var cursor:MovieClip = new MovieClip();
      function swfLoaded(event:Event):void {
         swfFrameRate = swfLoader.contentLoaderInfo.frameRate;
         if(_autoFPS) {
            FlxG.stage.frameRate = swfFrameRate;
         } else {
            FlxG.stage.frameRate = _manualFPS;
         swfLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE, swfLoaded);
         currentSWF = MovieClip(swfLoader.content);
         if(_autoScale) {
            _scaleX = getScreenWidth() / currentSWF.width;
            _scaleY = getScreenHeight() / currentSWF.height;
            if(_maintainRatio) {
               if(_scaleX > _scaleY) {
                  _scaleX = _scaleY;
               } else {
                  _scaleY = _scaleX;
         currentSWF.scaleX *= _scaleX;
         currentSWF.scaleY *= _scaleY;
         currentSWF.x = _swfX;
         currentSWF.y = _swfY;
         currentSWF.addEventListener(Event.ENTER_FRAME, checkFrame);
         FlxG.state.addEventListener(MouseEvent.CLICK, openSite);
         if(!_advanceAutomatically) {
            runLater(1000 * Number(_switchDelay), function(timeTask:TimedTask):void { advanceScene(); }, null);

      function openSite(event:MouseEvent):void {
         if(_websiteURL) {
            var urlR:URLRequest = new URLRequest(_websiteURL);

      function checkFrame(event:Event):void {
         if(_advanceAutomatically) {
            if(currentSWF.currentFrame == currentSWF.totalFrames) {

      function advanceScene():void {
         currentSWF.removeEventListener(Event.ENTER_FRAME, checkFrame);
         FlxG.state.removeEventListener(MouseEvent.CLICK, openSite);
         FlxG.stage.frameRate = stencylFrameRate;
         if(_fadeOutTime <= 0 && _fadeInTime <=0) {
         } else {
            switchScene(_nextScene.getID(), createFadeOut(((1000*_fadeOutTime))), createFadeIn(((1000*_fadeInTime))));
      override public function init():void
         var data:ByteArray = new mySWF();
         swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoaded);         
         cursor.addChild(new Bitmap(FlxG.mouse.cursor.pixels));
         cursor.scaleX = FlxG.scale;
         cursor.scaleY = FlxG.scale;

      override public function update():void {
         cursor.x = getMouseX() * FlxG.scale;
         cursor.y = getMouseY() * FlxG.scale;
      public function loadSWF(ignore:*, scene:GameState)
         nameMap["SWF X"] = "_swfX";
         nameMap["SWF Y"] = "_swfY";
         nameMap["Next Scene"] = "_nextScene";
         nameMap["Fade Out Time"] = "_fadeOutTime";
         nameMap["Fade In Time"] = "_fadeInTime";
         nameMap["Website URL"] = "_websiteURL";
         nameMap["Automatic Scaling?"] = "_autoScale";
         nameMap["Scale X"] = "_scaleX";
         nameMap["Scale Y"] = "_scaleY";
         nameMap["Maintain Ratio?"] = "_maintainRatio";

Ask a Question / Stop Event
« on: August 13, 2013, 03:38:02 pm »
Hi guys i need your help :)

I need to stop an scene event when i click on my actor button. How can i create it?

Windows / Mac / Flash / HTML5 / Darkfly
« on: August 06, 2013, 12:03:20 pm »
Hi everyone!
This is my first game in Stencyl :)

Size 1024x648

Ask a Question / Problem With StencylForge
« on: August 06, 2013, 09:51:49 am »
Hi all!!
I have a big problem, i can't upload my game in StencylForge because it's big, the game folder is 12MB

"Stencyl could not publish your game. The file size is greater than 16MB.

:( :(

How can I do this?

Ask a Question / Re: Re-create actor when self is death
« on: January 31, 2013, 08:53:12 am »
I have create the attributes X and Y and i have createthe beheviour XY

This is the "beheviour"

Ask a Question / Re: Re-create actor when self is death
« on: January 30, 2013, 11:30:44 am »
My actor have the death animation

Ask a Question / Re-create actor when self is death
« on: January 30, 2013, 04:28:09 am »
hi everyone, I would like to ask you, how to create this beheviour: when the actor dies in a region, it respawns at coordinates xy

Ask a Question / Re: Sound Problem
« on: January 30, 2013, 04:14:07 am »
It all ok thanks 1000  8) :D

Ask a Question / Re: Sound Problem
« on: January 22, 2013, 07:51:31 am »
When i'll be back home i'll try it :) thanks 1000

Ask a Question / Re: Sound Problem
« on: January 22, 2013, 05:29:14 am »
It is similar to "Move actor when on screen", but I want it with the sound.
When the enemy actor is in screen, it makes start a loop, and when it is out of screen, the loop stops. I've tried to create it, but I can't hear anything...

Ask a Question / Sound Problem
« on: January 22, 2013, 04:31:47 am »
Hi all, i have got some troubles about sounds in my videogame. I wanted to create a behavior to start the enemy actor's sound, when it is on screen. How can I create such a behavior?

Pages: 1