Need help integration an AS3, drawing in a .fla game

Hello

I created a drawing game by following a tutorial on this Web site: http://code.tutsplus.com/tutorials/create-a-basic-drawing-application-in-flash--active-162 7

It's pretty simple. (you can download the source file to have the same code as me and save time).

Now to the fun part!

Previously, I created an iPad in Flash application. Works fine by the way, is available on the App Store. (Looking for: Henri Godon-> free app)

My client wants this game must be integrated into its app with a possibility of 3 different color opon of drawing pictures. That is pretty easy to do.

I thought he just do a simple copy/paste and including scripts would do the trick... FAKE! I get errors when I try to export or test.

My App works fine without the game. And the great game works alone. This is just one that I try to incorporate what I'm stuck.

Here are my mistakes, hope someone has an easy DIY way I don't know since I've never done this before.

ERROR 1:

1037: packages cannot be nested.

Here's what it comes to the Main.as script:

package

{

import PNGEncoder;

import flash.display.MovieClip;

import flash.display.Shape;

import flash.display.DisplayObject;

import flash.text.TextField;

import flash.text.TextFormat;

import flash.text.TextFieldType;

import flash.text.TextFieldAutoSize;

import flash.display.BitmapData;

import flash.geom.ColorTransform;

import flash.events.MouseEvent;

import flash.events.Event;

import flash.utils.ByteArray;

import flash.net.FileReference;

SerializableAttribute public class Main extends MovieClip

{

ERROR 2:

Even if I try to remove the part, then I get another saying error

1114: the public attribute can only be used inside a package. (which is a bit obvious)

1084: syntax error: expecting leftbrace before var.

If nothing works after that...

I added the Main.as in the ActionScript parameter in the Document class. So, I know that it is responsible in some way, but after that I'm stuck!

Please help! I'd do anything.

var loader: Loader = new Loader();

var lc:LoaderContext = new LoaderContext(false,ApplicationDomain.currentDomain,null);

Loader.Load (new URLRequest ('yourgameswf.swf'), lc);

addChild (loader);

Tags: Adobe Animate

Similar Questions

  • Need help how to do a job of puzzle game

    Hey guys,.

    In case anyone is interested... I need help to get the last elements of my memory game of brainstorming on (flip two cards to see if they match) to work properly. I have it all set up so that when the two cards are turned over, it can be checked for accuracy and user can continue on with the game. I'm working on two other things that I don't know how I could do.

    (A) I need to make sure only two cards can be returned at the same time. At first I tried to do this by assigning a value to the expression (say 1, for each round) and whenever you click on a map, it checks for what the current value is. If the value was two, showing two cards had already been selected, all cards would be disabled. This eventually led to either never be able to re - activate, or only the first game and then not work again. Any ideas on how to prevent a user from flipping over 2 cards at the same time, then after checking the accuracy once again flipping of cards with a limit of two-card again?

    (B) related to the last question is the need to be able to have a card back (let me clarify by back flip, I hear a "card cover" or button essentially custom, I made that looks like a playing card.. ish would be re-shown having been hidden when selected), if after checking for a match, it is not really a game , or others if it is a mistake. Any ideas on how to do this?  Thank you very much in advance.

    I'll be sure to the credit of those in the project for your help.

    -Evan

    Did you look at the games that I have on my blog?

    http://lilybiri.posterous.com/concentration-game-created-exclusively-with-c

    http://lilybiri.posterous.com/gaming-in-Las-Vegas-DevLearn-2011

    Having a version for COP6 as well, unpublished, but talk about the changes in this film:

    http://www.YouTube.com/watch?v=Sy09xPoP69A

    The deactivation is possible as well...

    Lilybiri

  • Need help with as2 as3 conversion. Please, I beg you.

    Could someone help me to convert as2 as3, please?

    Source code:

    _root.magnet = 500;
    _root.magic = 10;

    and

    onClipEvent (load)
    {
        homex = this._x;
        homey = this._y;
        forcex = 1;
        forcey = 1;
    }
    onClipEvent (enterFrame)
    {
        x0 = this._x;
        y0 = this._y;
        x1 = this._xmouse;
        y1 = this._ymouse;
        distancex = x1 - x0;
        distancey = y1 - y0;
        distance = Math.sqrt(distancex * distancex + distancey * distancey);
        powerx = this._x - distancex / distance * _root.magnet / distance;
        powery = this._y - distancey / distance * _root.magnet / distance;
        forcex = (forcex + (homex - x0) / 2) / _root.magic;
        forcey = (forcey + (homey - y0) / 2) / _root.magic;
        this._x = powerx + forcex;
        this._y = powery + forcey;
    }

    I am a newbie in flash so if anyone can help with this would be great.

    I really need to be done please help me.

    MovieClip(root).magnet = 500;MovieClip(root).magic = 10;
    

    and

    var homex:Number = yourmc.x;var homey:Number = yourmc.y;var forcex:Number = 1;var forcey:Number = 1;
    
    yourmc.addEventListener(Event.ENTER_FRAME, loopF);
    
    function loopF(e:Event){    var x0:Number = e.currentTarget.x;    var y0:Number = e.currentTarget.y;    var x1:Number = e.currentTarget.mouseX;    var y1:Number = e.currentTarget.mouseY;    var distancex:Number = x1 - x0;    var distancey:Number = y1 - y0;    var distance:Number = Math.sqrt(distancex * distancex + distancey * distancey);    var powerx:Number = e.currentTarget.x - distancex / distance * MovieClip(root).magnet/distance;    var powery:Number = e.currentTarget.y - distancey / distance * MovieClip(root).magnet/distance;    forcex = (forcex + (homex - x0) / 2) /MovieClip(root).magic;    forcey = (forcey + (homey - y0) / 2) / MovieClip(root).magic;    e.currentTarget.x = powerx + forcex;    e.currentTarget.y = powery + forcey;}
    
  • Need help with illustrator cc/draw randomly

    Hello world

    When I got my iPad pro a few months ago I started to make a drawing in Adobe Draw, thinking I might later export it to vector to my office. Later I discovered that it is only possible if you have a paid subscription to CC. I use Illustrator cs6, so it is impossible to get out my iPad drawing.

    Is there anyone I could give my Adobe ID and is ready to connect his Illustrator cc to my account and save my work? It's just a drawing, but a major for me!

    Got it solved, thanks for the help!

  • Oracle need help-Basic RDBMS design drawing creation and

    Hello

    I need to create a set of the application of an RDBMS Oracle with SQL. The design includes to complete any entity-relationship and also to design the relevant schema with creations of the object. Important is-in the creation of patterns and objects... We should fully implement the standards. In addition, written all relevant SQLs in every step of this process.

    I need your help on the design completely and the implementation of the same. I am to complete this project school.

    The scenario: -.

    There's a COMPANY (STAR INTERNATIONAL *) WHO has many divisions/departments in there. These divisions have people who are used to working for them. The COMPANY has many products (we also say projects) and this work is done by the different ministries in addition, here things such as (1) employees may work or be part of several or several departments and work for several projects/products (2) as usual Department, each has a Manager. * each Department can process or only work on a single project.

    Q. How do you want to start with the design of DBMS for that matter? I am very new to all the matter and the reading of the definitions, but I feel once I'm able to complete this with all your help-i will understand.

    How many tables would be necessary for each of the elements and that all the attributes of each would have. Could you all please help and give the tables and columns, and also the relationship between them. How would you apply normalization designing.examples with sqls for that matter would be useful.

    Hello

    Welcome to the forum!

    The best way you can do is try it yourself, it's the best way to learn database design. At least try a solution and posted a question says.

    For example for the standardization of database are a lot of information on the Internet, see for example [rules of data normalization | http://www.datamodel.org/NormalizationRules.html]

    Kind regards

    Published by: Walter Fernández on February 21, 2009 07:10 - Add URL...

  • Need help integrating a dreamweaver file and an edge

    Good so I tried to do it for a lot in the long run so I ask help, it's for a web design class.

    I try to import an advanced composition to a dreamweaver file or use the file to publish from the file edge to make a site completed by adding a css navigation bar in an external css file. I want to have the menu css to the left of the logo. I tried this many times, but either the menu does not appear and is behind the scene of edge or is not there at all. When I tried from a fresh html page and it imported from a file oam, the images of the scene never showed up and I'm not sure how to fix this.

    6cG6vNc.png

    ^ just here.

    Here are the files

    Dropbox - Archive.zip

    Thanks for the help.

    {#cssmenu}

    position: relative;

    z-index: 1000;

    }

    Change dashboard animate object as well (whatever it is called in your markup):

    #Edge {position: relative; z-index: 1}

    Nancy O.

  • need help, erase the pencil draw request.

    How to erase any pencil drawing?

    Untitled.png

    my code

    import flash.display.Sprite;

    import flash.events.MouseEvent;

    var pencilDraw:Shape = new Shape();

    var activeColor:uint = 0 x 000000;

    var b:board = new board();

    addChild (b);

    b.x = 0;

    b.y = 0;

    var circle: c1 = new c1();

    addChild (circle);

    Circle.x = 50;

    Circle.y = 50;

    var bclean:bt = new bt();

    addChild (bclean);

    bclean.x = 0;

    bclean.y = 0;

    bclean.addEventListener (MouseEvent.CLICK, hbclean);

    function hbclean(e:MouseEvent):void

    {

    trace ("click button");

    pencilDraw.graphics.clear ();

    }

    circle.addEventListener (MouseEvent.MOUSE_DOWN, startPencilTool);

    circle.addEventListener (MouseEvent.MOUSE_UP, stopPencilTool);

    function startPencilTool(e:MouseEvent):void

    {

    pencilDraw = new Shape();

    b.addChild (pencilDraw);

    e.target.startDrag ();

    pencilDraw.graphics.moveTo (circle.x, circle.y);

    pencilDraw.graphics.lineStyle (10, activeColor);

    stage.addEventListener (MouseEvent.MOUSE_MOVE, drawPencilTool);

    }

    function drawPencilTool(e:MouseEvent):void

    {

    pencilDraw.graphics.lineTo (circle.x, circle.y);

    e.updateAfterEvent ();

    }

    function stopPencilTool(e:MouseEvent):void

    {

    stopDrag();

    stage.removeEventListener (MouseEvent.MOUSE_MOVE, drawPencilTool);

    }

    If you remove the line that keeps creating new forms then your pencilDraw object will include all the lines so when you run the hbclean function to erase all the lines.

    function startPencilTool(e:MouseEvent):void

    {

    pencilDraw = new Shape();

    b.addChild (pencilDraw);  This could be moved to the original creation

    e.target.startDrag ();

    pencilDraw.graphics.moveTo (circle.x, circle.y);

    pencilDraw.graphics.lineStyle (10, activeColor);

    stage.addEventListener (MouseEvent.MOUSE_MOVE, drawPencilTool);

    }

  • need help please this as3 code

    I got a book called

    ActionScript 3.0 adobe flash pro cs4 classroom in a book

    Well I'm on lesson 2 and I followed all the steps to the letter its supposed to let the user choose a language, but when I play the film the text I want to come to the top is garbled for some reason any?

    so, if someone could help thanks

    I am using cs5 idk if it matters

    http://www.mediafire.com/?memijczzo1y

    In CS5, go to 'Text'---> '... embedding fonts» (Pic.1)

    Click 'all', (PIC.2)

    Then click on the ' Add ' button. (Fi g. 3) The police will appear below.

    Then click OK

    PIC.1

    PEAK. 2

    PEAK. 3

    Test your animation.

    Should work now.

  • need help integrating the Seagate backup device has (including Norton) with my PC reconfigured under Vista Home Basic(which I feel has a virus/adware).

    For awhile, I got my Seagate FreeAgent GoFlex - who had pictures, Favorites and my Norton 360 - my 2007 Dell PC security. I ran some time without him and maybe adware or virus. There are more photos, mostly same Favorites and no security suite. Is it possible to run the Seagate Nortonfrom? All data can be embedded, and then run the Norton and zap the malware?

    Your message is in the forum for anti-malware for Microsoft Security Essentials (MSE) program.

    Because Norton is your provider of anti-malware you must request assistance from Norton Support: http://us.norton.com/support/

    Kind regards...

  • aoe3 disk installation lost need help to find he can't buy new game

    moved and lost now installation disk cannot read any help out there

    Please see:

    http://support.microsoft.com/kb/326246 .

  • Need help blackBerry Smartphones 9810 ~ cannot download google app game?

    I'm not very mobile friendly and gave this blackberry so I can get the application of motogp, however when I try it says my device is supported, can anyone help in simple terms

    Thank you sharon

    Correct response of Esperoni, when you visit App World from your phone, only applications that are compatible with your phone will be displayed.  Take a tour of your phone and if you do not see the application, it will not work on your phone.

    I hope that helps you.

  • New to Flash, need help.

    I'm new in the world of Adobe Flash and who need help. I have a banner rotator fla file is an xml file to produce the content. My question: How can I rename the file "config.xml" in "BannerConfig.xml" xml and still have it work with the flv file?

    We need a code in the FLA somewhere that specifies the name of the file to edit.  The code must be on the time line of the (or a).  If you see a frame (or frames) in the calendar that has a lowercase 'a' in this document, select this image and open the Actions window to view the code.  It is always possible that the code inside a movieclip as well.  And if the file uses AS2, it could even be attached to a symbol on the stage, in which case you will need to select the symbol on the stage, while the Actions panel is open to see the code.

  • Need help with AS3!

    Hello! I need help on as3. I'm still a noob at this stuff.

    I'm doing a simple game. You must click on the bugs that moves randomly to the bottom of the screen. When you click on the bugs, they will become invisible

    and if none of the bugs through the bottom of the screen, you lose 1 live.

    But right now, im of the problems with the script. When I click on the bugs and she go, life is further reduced. I don't understand.

    And theres also error coming out. "TypeError: Error #1009: cannot access a property or method of a null object reference."

    " to buh_fla::MainTimeline/tekan().

    Here is the script:

    ===================================

    Stop();

    import flash.events.Event;

    import flash.events.MouseEvent;

    var iscore:int = 0;

    score. Text = iscore.toString ();

    var health: int;

    health = 3;

    trace (Health);

    for (var i: int = 0; i < 10; i ++) {}

    var f: bug = new bogues();

    addChild (f);

    var fn = Math.round (Math.random () * 2) + 1;

    f.gotoAndPlay (fn);

    f.x = Math.random () * stage.stageWidth;

    f.SP = Math.random () * 7;

    f.addEventListener (Event.ENTER_FRAME, animate);

    f.addEventListener (MouseEvent.CLICK, klik);

    }

    function klik(e:MouseEvent) {}

    e.target.visible = false;

    iscore += 1;

    score. Text = iscore.toString ();

    }

    function animate (e: Event) {}

    e.Target.y += e.target.sp;

    if(e.Target.y > stage.stageHeight) {}

    -health;

    trace (Health);

    e.Target.y = - 20;

    e.Target.Visible = true;

    {if(health==0)}

    gotoAndPlay ("gameover")

    }

    }

    }

    ============================================

    You lose life because you are not to remove bugs or their listener but only making them invisible

    function klik(e:MouseEvent) {}

    e.Target.Visible = false;

    iscore += 1;

    score. Text = iscore.toString ();

    to this code

    var delbug = e.currentTarget
    delbug (Event.ENTER_FRAME, animate) .removeEventListener;

    removeChild (delbug)

    }

    --

    http://ww.darshanrane.com

  • Charger (need help to convert AS2 AS3)

    Because I know that this code works very well and that I use it in one of my flash AS3, I need it in one of my flash AS2 and I do not know how to adapt. I searched more than 100 threads and I can not find something similar... Thank you to help me make it work in AS2! As I need in AS2, I thought it would be the right place to post.

    I posted the entire process of loading code, but I need help especially with the charger part. How to do this in AS2? Thank you!

    var img = 0;
    var image_total = 0;

    var myImages_array:Array = new Array();
    var myBitmaps_array:Array = new Array();

    function Init();

    {

    Image URLS is loaded into a table before this call
    LoadImage();

    }


    function LoadImage()
    {
    If (img, myImages_array.length) / / img is the index of the current image and myImages_array is my URL table
    {

    I need help with this framework, you can
    var loader: Loader = new Loader();

    / / Returns the full path of the image and load it
    Loader.Load (new URLRequest (my_site_url + myImages_array [img]));
    loader.contentLoaderInfo.addEventListener (Event.COMPLETE, imageLoaded);

    }
    on the other
    {
    If (count == 0)
    {

    When everything is loaded, I'll start loading my Bitmaps in a short slide show
    Count += 1;
    init_slideshow();
    }
    }
    }

    function imageLoaded(e:Event):void
    {
    Bitmap of the image: var = e.target.content;

    Bitmap manipulation (deleted) here

    image_total = myBitmaps_array.push (image);

    If (img < myImages_array.length)
    {
    IMG += 1;

    Call the following image
    LoadImage();
    }
    }

    function init_slideshow (): void
    {

    The current index for the first Reserts
    IMG = 0;

    Start the slide show, since everything is loaded
    animate_slideshow();
    }

    Look at the MoveClipLoader class and the addListener method that supports.

  • Plan a game in AS3, need help

    Hi so I'll make quite a big game/app in AS3 and I need someone to point me in the right direction, I know as3 and have programmed many games.

    This game will include multiplayer and we're going to do this, use smartFox.

    Now the area I need some information on are servers to hold the details of the player. (Level etc., species)

    First of all:

    How to set up a server? Use MySQL? Is a Web page that I can connect to my game?

    How would I connect to it via AS3? I have to use SELECT MySQL and MySQL files to find the player and then send back it details?

    Basically, I need to know how the games as configuration servers FarmVile to contain details of the player because I have to do the same thing for this game.

    It's really how to get data to the game to you. When you use classes like URLLoader you can send variables (via GET or POST) on the server to authenticate and process your application. At that time then your PHP script is responsible to read the request and to answer with the information however you like it.

    For your first game, that I would recommend you stick with very structures known as XML or JSON for responses from your PHP scripts.

    For example, if you use JSON, first configure you your application in AS3, to say things that you receive text gross (binary or varying URL) return code. Your PHP script receives the request, performs the necessary operations (on the basis of data, etc.) to get the information you need. He is then responsible for structuring this back to what awaits Flash (JSON) and as you probably know PHP has built-in JSON (http://php.net/JSON) encoding. After your response of crafts and print, AS3 that will consider a response. Can you decode side AS3 as JSON and use the information according to your needs.

    Finally in the future when your game balance grows, you can start making web services which manage more efficient binary formats such as the authority of the financial markets. Then you can do it with the standard messages is not even worth performance wise. Also, you will go from HTTP requests to direct applications of socket. If your game is standard you can even use web based RESTful services so look at those if you're not familiar.

    Yes, you will need a host, but I can't recommend one because I have no idea what you're building. If you plan to build an MMO so no web host will really make you account inexpensive cluster hosted for this scale of a game. If it's just tracking the leader boards and user accounts then I often use hosts that adapts to of lowercase/cheap dedicated using my own equipment, like site5.com.

Maybe you are looking for

  • Audio problem NB100 - pregnant no sounds, with headphones, it's ok

    Hello need help, please. I have a brand new Toshiba nb100-10y, but have no sound - without headphones. To say my speakers no sound.OS: XP Pro SP3, Device Manager Winndows is ok, do not have any yellow mark exclamation. And as I said, with headphones,

  • Qosmio G30: I am looking for an atenna with the appropriate male connector

    My G30 came with an analog TV tuner antenna adapter. The adapter is female. IM hardly an atenna with the appropriate male connector to connect this adapter. I tried one type of coaxial cable but failed. In this case, what is the type of connector sho

  • No sound - system, music, etc.

    I don't get any sound out of my hp pavilion a1350y computer desktop with Windows XP.  Speakerphone is on, volume settings are all the greater.  Recently, I replaced the video card, do not know if the sound worked just before replacement.

  • How can we download WMV (Windows media video)?

    How can we download WMV (Windows media video) because the thing is that my walkman can play wmv files and its not downloaded on my computer. I tried windows media player, but it did not work!

  • Help me buy a new all-in-one which will scan to pdf with preview multipage

    I need a new all-in-one, like the OfficeJet HP 6700 Premium e-all-in-one printer, which I watched in a store.  The box was not clear about the capabilities. What I do with old HP all-in-one on an old XP, (11-12 years) old machine is scanning document