Need help moving my code from the timeline into classes

Hello everybody,
A few months ago I made a simple flashgame with the help of a tutorial (http://www.flashgametuts.com/tutorials/as3/how-to-create-a-brick-breaker-game-in-as3-part- 1/) as a school assignment. When I turned it in to my teacher, his biggest complaint was that the code was written onto the timeline instead of in seperate classes. I know virtually nothing of programming (dealt with agoraphobia while the classes took place ), so I was wondering if someone could help me move the code into classes.
Here's the complete package for the game: https://www.dropbox.com/sh/xhjuhz04z8g129m/0nSwf1wngu
Thanks!

You will need to learn about classes. I suggest that for the moment you set your actual project to the side--but keep it in mind--and work on some smaller chunks. Do some tutorials and learn a bit. Then try and apply what you have learned to your project.
http://www.untoldentertainment.com/blog/2009/08/25/tutorial-understanding-classes-in-as3-p art-1/
Work on the individual bits and post more specific questions when you run up against them.
It will require shifting your thoughts a bit on how to design and structure things. For me the really key concept is encapsulation--the idea that your classes are self-contained and have very specific routes of communication for receiving and sending information. To achieve this you need to think about methods, properties, and events. If you've done regular timeline coding you probably recognize properties (x, alpha, htmlText, etc.) and events (MouseEvent.CLICKED). Methods is a fancy word for function. So when you do something like myMovieClip.gotoAndStop(5) the gotoAndStop is a method of the MovieClip class and that just means somewhere there is code like this:
function gotoAndPlay(frame:Object, scene:String=null):void{
     // code that tells flash how to move the movieclip to a frame
That is a bit of a simplification, but conceptionally it is what you will do for the methods of your classes.

Similar Messages

  • Need help moving videos/photos from Galaxy S4 to iMac

    need help moving videos/photos from Galaxy S4 to iMac
    Samsung's utility Kies is awful
    Hlpe please

    did this
    import photos from android to mac
    got this, try it
    http://www.phototransferapp.com/help/android/transfer_photos_from_your_android_t o_your_mac/
    or use the first link to try some of the google hits for ways to get photos from android devices into osx

  • I need help with this tutorial from the Adobe website

    I'm almost done with my flash game which I created with flash pro cc. And i have been looking for tutorials to integrate my game to the Facebook and this is the only one I found. http://www.adobe.com/devnet/games/articles/getting-started-with-facebooksdk-actionscript3. html
    Am I on the right track?? The editor uses Flash Builder but I'm using Flash Pro cc.
    --- On Step 2: "Set up a development server for the Flash app",
            Sub-step #2. "To simplify the development process, configure Flash Builder to compile into your htdocs/fbdemo folder and run (or debug) the app on your server (see Figure 2)."
    1) But I can't find "ActionScript Build Path"(which is highlighted on the Figure 2 screenshot) or anything like that in Flash pro. Same for the "Output folder URL".
    Can I actually do the same things with Flash Pro cc?? Also #3 is "Verify that your app runs from your server." How do you run your app from your server??
    ---- On Step 4: "Initialize the Facebook JS SDK",
    2) so if I setup a server on a localhost just like the tutorial, I don't need to change the following? This is on line #6.
    channelUrl : 'www.YOUR_DOMAIN.COM/channel.html'
    can i just leave it like that ?
    3) So if I complete the tutorial, can facebook users play my game? or do i have more things to do?
    4) is there any other tutorial for Flash Pro CC to Facebook integration???
    Thank you so much for your help and time.

    this is an excerpt from http://www.amazon.com/Flash-Game-Development-Social-Mobile/dp/1435460200/ref=sr_1_1?ie=UTF 8&qid=1388031189&sr=8-1&keywords=gladstien
    The simplest way to hook into Facebook is to add their Plugins to add a Like button, Send button, Login button etc to your game.  If you only want to add a Like button to a page on your website, you can use the following iframe tag anywhere (between the body tags) in your html document where you want the Facebook Like button to appear:
    <iframe src="http://www.facebook.com/plugins/like.php?href=yoursite.com/subdirectory/page.html" scrolling="no" frameborder="0" style="border:none; width:500px; height:25px"></iframe> 
    Where the href attribute is equal to the absolute URL to your html file.  For example:
    <iframe src="http://www.facebook.com/plugins/like.php?href=kglad.com/Files/fb/" scrolling="no" frameborder="0" style="border:none; width:500px; height:25px"></iframe>
    points to index.html in kglad/com/Files/fb.
    However, to get the most out of Facebook you will need to use JavaScript or the Facebook ActionScript API and register your game on the Facebook Developer App page.  Before you can register your game with Facebook, you will need to be registered with Facebook and you will need to Login. 
    Once you are logged-in, you can go to https://developers.facebook.com/apps and click Create New App to register your game with Facebook.  (See Fig11-01.) 
    ***Insert Fig11-01.tif***
    [Facebook's Create New App form.]
    Enter your App Name (the name of your game) and click continue.  Complete the Security Check (see Fig11-02) and click Submit.  You should see the App Dashboard where you enter details about your game.  (See Fig11-03.)
    ***Insert Fig11-02.tif***
    [Security Check form.]
    ***Insert Fig11-03.tif***
    [App Dashboard with Basic Settings selected.]
    If you mouse over a question mark, you will see an explanation of what is required to complete this form.  Enter a Namespace, from the Category selection pick Games, and then select a sub-category. 
    Your game can integrate with Facebook several ways and they are listed above the Save Changes button. You can select more than one but for now only select Website with Facebook Login and App on Facebook, enter the fully qualified URL to your game and click Save Changes. (See Fig11-04.)
    ***Insert Fig11-04.tif***
    [Facebook integration menu expanded.]
    You can return to https://developers.facebook.com/apps any time and edit your entries.  Your game(s) will be listed on the left and you can use the Edit App button to make changes and the Create New App button to add another game.
    Click on the App Center link on the left.  (See Fig11-05a and Fig11-05b.)  Fill in everything that is not optional and upload all the required images. Again, if you mouse over the question marks you will see requirement details including exact image sizes for the icons, banners and screenshots.
    ***Insert Fig11-05a.tif***
    [Top half of the App Center form.]
    ***Insert Fig11-05b.tif***
    [Bottom half of the App Center form.]
    When you are finished click Save Changes and Submit App Detail Page.  You should then see Additional Notes and Terms. (See Fig11-06.)
    ***Insert Fig11-06.tif***
      [Additional Notes and Terms.]
    Tick the checkboxes and click Review Submission.  If everything looks acceptable, click Submit.  You should then see something like Fig11-07.
    ***Insert Fig11-07.tif***
      [After agreeing with Facebook's terms, you should be directed back to App Center and see this modal window.]
    You are now ready to integrate your game with Facebook's API.  Because there is a Facebook ActionScript API that communicates with Facebook's API, you need not work directly with the Facebook API.
    But before I cover Adobe's Facebook ActionScript API, I am going to cover how you can use the Facebook JavaScript API directly.  There no reason to actually do that while the Facebook ActionScript API still works but by the time you read this, the Facebook ActionScript API may no longer work.
    In addition, this section shows the basics needed to use any JavaScript API so it applies to any social network that has a JavaScript API including the next "hot" social network that will arise in the future.

  • I need help in sync music from the ipod store that I have purchased to my ipod.

    I need help syncing my music onto my ipod.  Anyone there to help?

    There is a few events where I could see this happening...
    It's possible if you computer is not authorized with your iTunes Store account it may not have transfered your purchases from the iPad to the computer. To check, Open iTunes> Select the "Store" menu along top of the program and select Authorize this computer. Sign in with your AppleID and password, this will make sure your computer is authorized for the future so you can transfer purchases from your device.
    http://support.apple.com/kb/HT1848
    However, if your Movies are missing now you'll need to request to redownload or "regrant" them. Please send an email ticket into iTunes Store via...
    http://www.apple.com/support/itunes/
    Select "Video Purchases" in the grey boxes, then "Lost or Missing Items", then click the link to "Email Us" on the right. Fill out that form and the folks at the iTunes Store should get back to you less than 24 hours.

  • Need help moving music collection from external hard drive to Macbook Pro

         I just bought a Macbook Pro today after my Windows desktop was bricked a few weeks ago. Luckily, I didn't lose the most important files on my pc, my music, because it was all on my Zune, as well. So, I borrowed an external hard drive, copied all of the music from my zune onto a friend's pc, and then copied it again from their pc to the external. Finally, I just plugged the external into my new mac, copied the folder within it holding my music, and hit "paste item" in the "Automatically Add to iTunes" folder. Initially, everything seemed to work perfectly, however, after transferring a little over 7 of my 54gb of music, an error message appeared saying that the operation was ending because it could not transfer all files.
         I then tried playing a file off of the hard drive, a wma, and received a prompt that the file was incompatible with Quicktime player, the default for no apparent reason. I tried then opening it with iTunes, and nothing happened, as far as I could see. Naturally, my next step was to google how one would transfer wma files to a mac, and, to make matters even more confusing, all of the results seemed to tell me that iTunes should automatically convert wma files to mp3, which does not seem to be happening in my case.
         I'm still not sure why this isn't working, as I'm sure more than 7gb of my music collection is non-wma, so that doesn't even seem to be the sole issue. Any help with importing my collection would be hugely appreciated, as I'm enjoying my mac so far, but will have to return it if I can't get music on here.
         Thanks.

    One problem is that iTunes for Mac can't handle WMA files, iTunes for Windows will convert them, but not iTunes for Mac. When you add unprotected WMA files to your iTunes library (Windows only), iTunes converts them to new files that iTunes can play, based on your import settings. See if you can use your friend's PC to do this.  If the borrowed PC has iTunes, create an alternate iTunes library so you don't mess up your friend's library.  This explains how:  http://support.apple.com/kb/HT1589
    This support document might be helpful:  iTunes: About the Add to Library, Import, and Convert functions, http://support.apple.com/kb/ht1347

  • I need help with viewing files from the external hard drive on Mac

    I own a 2010 mac pro 13' and using OS X 10.9.2(current version). The issue that I am in need of help is with my external hard drive.
    I am a photographer so It's safe and convinent to store pictures in my external hard drive.
    I have 1TB external hard drive and I've been using for about a year and never dropped it or didn't do any thing to harm the hardware.
    Today as always I connected the ext-hard drive to my mac and click on the icon.
    All of my pictures and files are gone accept one folder that has program.
    So I pulled up the external hard drive's info it says the date is still there, but somehow i can not view them in the finder.
    I really need help how to fix this issue!

    you have a notebook, there is a different forum.
    redundancy for files AND backups, and even cloud services
    so a reboot with shift key and verify? Recovery mode
    but two or more drives.
    a backup, a new data drive, a drive for recovery using Data Rescue III
    A drive can fail and usually not if, only when
    and is it bus powered or not

  • I need help moving my pictures from my iPhone 5s to my Macbook Pro

    I had my iPhone synced with a hard drive that i just swapped out with a solid state. I lost all of my pictures on my old hard drive, but they are all still on my iPhone. There in a folder labeled "Macbook Photos", but i can not figure out how to transfer those photos onto my new hard drive. All of the photos in my camera roll sync up to iPhoto with no problems, but all my other ones stay on the iPhone. Does anybody know a trick to move these hidden photos onto my Macbook Pro?

    Hey WinstonR22,
    Thanks for the question. I see you came from the most relevant article, so you are definitely on the right track. You'll want to follow the steps in this article for transferring information using iTunes:
    iOS: Transferring information from your current iPhone, iPad, or iPod touch to a new device
    http://support.apple.com/kb/HT2109
    Excerpt:
    7. When the restore process is complete, your device will restart. Then it will be ready for use. You should keep your device connected to iTunes to sync data not contained in the backup (such as music, videos, apps, and so on). You can verify and change which data are synced by clicking the syncing tabs in iTunes.
    Note: If you restored from an unencrypted backup, you will need to enter password for your Apple ID, email and other accounts and voicemail again. If you've forgotten your voicemail password, contact your carrier.
    Thanks,
    Matt M.

  • NEED HELP ASAP-populate contents from 5 tables into one master table

    Scenario:
    Assign a new_customer_id to each existing customer of our three business. A master lookup table (M) was given to me with pre-populated (SEQ_NOs), (NEW_CUSTIDs), and NULL in (OLD_CUSTIDS). My duty is to
    (1) Fill the M.OLD_CUSTID column with existing customer ids from T1, T2, T3 (uniquely).
    (2) Once the master lookup table is filled, add (SEQ_NO), and (NEW_CUSTID) column to the 3 existing customer tables to hold the new information.
    (3) At the end of the project, remove the existing customer ids from the T1, T2, T3.
    My problem is that there are no associations between the master table and existing customer tables (no keys). The code would be:
    update M
    set OLD_CUSTID= (select OLD_CUSTID from T1 where M.??=T1.??)
    Since the M.OLD_CUSTID and T1.NEW_CUSTID are NULL at this stage, and there are no keys to tie them together. I don't know how to fill both tables. Can someone help me ASAP? Thanks in Advance.
    -ORACLE Newbi

    I am building a "MASTER LOOKUP TABLE" to map the NEW_CUSTID and the OLD_CUSTID. The columns in this M table are:
    CREATE TABLE MKT.M
         "LOOKUP_SEQ" INTEGER, <=== from sequence
         "NEW_CUSTID" CHAR(6), <=== populated with strings given by biz analyst
         "OLD_CUSTID" INTEGER, <=== need to dump all existing custid (unique)
         PRIMARY KEY ("NEW_CUSTID") RELY NOVALIDATE
         ORGANIZATION INDEX TABLESPACE "MKT"
    Table T1/T2/T3 are slightly different but they all contain:
    CUST_ID INTEGER
    CUST_NAME CHAR(50)
    CUST_SINCE DATE
    CUST_ADDR1 CHAR(30)
    CUST_ADDR2 CHAR(30)
    DITY CHAR(30)
    STATE CHAR(2), etc.
    Since M is the lookup table for old-to-new customer ID mapping. There are no need to associat other than just enter the old IDs into the M table.
    Thanks for helping me. Any suggestion?

  • How to get trigger code from the schema into a file

    Please help me in getting code of any trigger from the schema, without using any data dictionary views.

    In fact you can get the trigger code by using tools like toad,sql developer
    But all are using the data dictonary view to get the code .

  • I need help moving two objects at the same time

    I am try to create a code that will move a mini map to where the user wants in a game. As a test I created a square and converted it to a movie and named it sq. Then I created another square and converted it to a button and named it bt. I also made bt half the size of sq and placed bt at the center of sq. I then created a drag code which like this:
    sq.addEventListener(MouseEvent.MOUSE_DOWN, startDragging); // Start dragging square by user
    sq.addEventListener(MouseEvent.MOUSE_UP, stopDragging); // Stop dragging square by user
    function stopDragging(evt:MouseEvent):void
    sq.stopDrag();
    bt.x=sq.x;
    bt.y=sq.y;
    // this moved bt to sq(x,y) when mousebutton was released
    function startDragging(evt:MouseEvent):void
    sq.startDrag();
    bt.x=sq.x;
    bt.y=sq.y;
    // this moved bt to sq(x,y) when mouse button was pushed down
    I am trying to get sq and bt to move smootly together, but as it stands right now it just jumps from place to place.
    I have tried looking for some kind of linking code in abode help search, however, I am not sure want to look for exactlly

    The mouseDown and mouseUp events are single action events, so the button will only change positions on either the mouseDown or the mouseUp events. If you add a mouseMove event listener, then you can change the location of the button every time the square moves. Alternately, you could use an enterframe event to change the location of the button relative to the square. Try this code:
    sq.addEventListener(MouseEvent.MOUSE_DOWN, startDragging); // Start dragging square by user
    sq.addEventListener(MouseEvent.MOUSE_UP, stopDragging); // Stop dragging square by user
    sq.addEventListener(MouseEvent.MOUSE_MOVE,dragButton);
    function stopDragging(evt:MouseEvent):void
    sq.stopDrag();
    function startDragging(evt:MouseEvent):void
    sq.startDrag();
    function dragButton(evt:MouseEvent):void {
              bt.x = sq.x;
              bt.y = sq.y;

  • Please help 'Translate' These codes from AS2 to AS3 for me

    Hi, i need help 'translating' these codes from Action Script 2 to Action Script 3. Please Do it for me:
    toc    loadText = new LoadVars();
        loadText.load("Curie.txt");
        loadText.onLoad = function(success) {
            if (success) {
                // trace(success);
                Curie.html = true;
                Curie.htmlText = this.Curie;
    Please translate it for me, i need it ASAP thanks
    Kenneth

    Thank you for helping me
    Kenneth
    Date: Thu, 15 Oct 2009 05:49:14 -0600
    From: [email protected]
    To: [email protected]
    Subject: Please help 'Translate' These codes from AS2 to AS3 for me
    Take a look at that:
    http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/migration.html
    There is a LoadVars section on that.
    There is also a tutorial here:
    http://www.republicofcode.com/tutorials/flash/as3externaltext/
    Cheers,
    CaioToOn!
    >

  • I need help moving my Photoshop 7 from my old laptop to my new laptop which is running Windows 7 Enterprise.  I've tried two routes unsuccessfully.  I install the CD, it does not autoplay.  I execute Autoplay.exe at the root directory, I am welcomed, I ch

    I need help moving my Photoshop 7 from my old laptop to my new laptop which is running Windows 7 Enterprise. I’ve tried two routes unsuccessfully. I install the CD, it does not autoplay. I execute Autoplay.exe at the root directory, I am welcomed, I choose English, I accept the EULA, I get the Install/Explore choices window, with the Install button already selected, I click the Photoshop button, the CD spins, and nothing happens.  In the 2nd attempt I execute Setup.exe in the Photoshop directory, and nothing happens at all.  I’m never even offered the opportunity to enter my product code. What should I do?

    There could is likely a compatibility problem between the old software and the newer operating system.

  • My i tunes account keeps telling me to enter valid security code from the back of my CC. i do and it keeps saying to enter it. i tried like 3 differnt cards. pls help cause i need apps for my new ipad3. thx

    hello, my itunes account keeps telling me to enter  a valid security code from the back of my CC. i do and it keeps saying to enter a valid one. i tried 3 differnt cards???? pls helppppp

    Usually there is some subtle difference other than the security code. E.g. your bank/credit card company says you live on Easy Street but you wrote Easy St. Compare your bank/credit card statement with the information you are trying to give Apple. If they don't match, for any reason, validation will fail with the same error message. No point giving the potential ID thief clues is there?
    tt2

  • I have an itouch, most songs i got off my cd's. i have a new laptop and want to put songs from itouch to laptop.I can only get the songs that i purchased onto the laptop? need help with how to get the rest from itouch to laptop please??

    i have an itouch, most songs i got off my cd's. i have a new laptop and want to put songs from itouch to laptop.I can only get the songs that i purchased onto the laptop? need help with how to get the rest of the songs (from my cd's) from itouch to laptop please??

    See this previous discussion:
    Recovering your iTunes library from your iPod or iOS device: Apple Support Communities

  • Need help moving text

    Using CS4 on Win7 Pro. My client bought a template that has a flash piece and I am a total novice in Flash but I do know that you edit the FLA file and export it as a movie. So I opened the FLA file and I'm able to edit the text (all that I want to do right now) but some of the text I'm replacing is longer than the original so it gets hidden under a replay button and some is shorter and is spaced too far away from the replay button (I also want to change the color of that and I think I can figure that one out). There is plenty of room to the left for the text to move to as the original file does have varying lengths of text and it does adjust for that but I can't figure out how to change it for what I've done (I haven't received the final text yet so this is a practice run)... I changed the text by going to the timeline and selecting text from the icon (Edit Symbols) in the upper right of the screen. But where do I tell it where the text should start or how wide it needs to be? I tried moving them individually in the timeline but that didn't change it.
    Here's the file: http://do-rightweb.com/fertility/flash/header_vJT.fla (I only want to leave this up temporarily because it is huge. The test location of the file in action is here: http://do-rightweb.com/fertility/
    In the future I may have to swap out some of the images leaving the transitions which I think I can do by adding them as a layer deleting the ones I'm replacing...
    So if anyone can lend a hand in helping me figure out how to adjust the text width I would be totally jacked! Any help and advice about swapping images or changing colors would be greatly appreciated too. Or even a link to a video to help me understand how to reverse engineer this would be cool.
    Thanks in advance for your help and assistance!

    Hi,
    Since the text animation is done using the timeline in this file you have to manually edit the positioning of the each symbol element in every keyframe i.e
    You have to go in to the editing mode for txt_c instance of txt_2 > Layer 8 where the required elements are placed
    1. You have to position the Layer 1(under Layer 8) items at every key frame for the display text
    you may have problem while positioning second text onwards as you will not be seeing them on stage. For this you may want to duplicate the symbol(txt_5) at key frame 37 and edit it to have only the second text and remove everything else. And you can swap the existing symbols at key frame 44 and key frame 54. You can repeat this for the rest of the text.
    2. Next you have to position the numbers which spread across three layers (txt_3, txt_4 and Layer 6) under Layer 8. They are for prefix number, suffix number and the dot respectively
    Thanks!

Maybe you are looking for