Can anyone explain to me how I can place an actor using code, the entire code I need to use, or perhaps point out the flaws in my code. I like using stencyl but stencyl doesn't extend to all things. I find when it comes to placing objects that Stencyl is not very accurate, so I'd like to use code for that. I am also using stencyl to learn code before I get a better program, so this'll help me. Anyway, after doing some snooping online, I found out how you could place an object in other as3 programs, however stencyl coding is different. I always act under the assumption that an actor is equivalent/ an example of what a "movie clip" would be in other programs. Anyway, here's my coding:
package scripts
{
import flash.events.*;
import flash.net.*;
import flash.filters.*;
import flash.display.BitmapData;
import Box2DAS.Collision.*;
import Box2DAS.Collision.Shapes.*;
import Box2DAS.Common.*;
import Box2DAS.Dynamics.*;
import Box2DAS.Dynamics.Contacts.*;
import Box2DAS.Dynamics.Joints.*;
import stencyl.api.data.*;
import stencyl.api.engine.*;
import stencyl.api.engine.actor.*;
import stencyl.api.engine.behavior.*;
import stencyl.api.engine.bg.*;
import stencyl.api.engine.font.*;
import stencyl.api.engine.scene.*;
import stencyl.api.engine.sound.*;
import stencyl.api.engine.tile.*;
import stencyl.api.engine.utils.*;
import org.flixel.*;
public dynamic class Design_7_7_ extends SceneScript
{
//Expose your attributes to StencylWorks like this
[Attribute(id=01, name="GarbageCam", desc="Button")]
public var attributeName:String;
//Then in the constructor or init(), add it to the nameMap like this
//nameMap["Display Name"] = "attributeName";
//This lets API calls using attribute names to use the display name
//Do all actor initialization here
override public function init():void
{
addWhenUpdatedListener(null, update);
addWhenDrawingListener(null, draw);
}
function beginCode():void
"GarbageCam".addEventListener(Event.ENTER_FRAME, placeButton);
}
function placeButton (event:Event) :void{
placeButton.x = 20();
//This is executed every frame of the game
}
beginCode()
}
I can't take a screenshot, so I'm assuming it'll be hard to help me out with this, but this is all i can do really.
GarbageCam is my actor
placeButton is the function i want it to do (this was on the website that I used to learn how to place things)
Now I'm completely lost. If you can;t help me, you cant help me but please dont be mean about it. I have no experience with code so you'll have to bare with me. Thanks