Help with AS3 and buttons

I need urgent help for a college project, I drew a map and I have a few photos that appear in terms of the timeline, one after the other. I want the timeline to be activated when I press a button on the sheet where I've been on vacation, but I have no idea of how to put together.

While I can offer some ideas, you will need to spend time to find out how to use Flash... maybe get formal training with her.

For photos, create each set as a movieclip and give to each movieclip an instance name so that you can control its visibility by using code.  Initially, you will want to set the visible property of them all to false, made probably in the first frame of the timeline (ex: imageGrp1.visible = false;).  Then, you use your buttons so that they are visible.

Code on one of the buttons, you must assign an instance as well name.  Then, you must assign an event listener for this button to detect when it is selected and a function handler to go with the event listener, the listener calls the function in action when the event occurs.

ex:

the event listener for a button with an instance name of imgGrp1Button...

imgGrp1Button.addEventListener (MouseEvent.CLICK, showGrp1);

and function of event handler for the CLICK listener

function showGrp1(evt:MouseEvent):void {}

imageGrp1.visible = true;

}

If you want to hide any visible game when you select a new, then you can create a function that defines them all visible = false and the call that work well at first in 1 frame and each key event handler function (before setting the selected to be visible).

Tags: Adobe Animate

Similar Questions

  • Help with animation and buttons

    So, I have a small question. I have an animation that is configured to stop when I open the swf file. A 'play' button is ther and works fine, when I hit him he plays through the animation, but stops once it's done. I need the looping animation at the beginning. Can someone help me?

    If you have a bunch of code the first image that defines what you can not return to the first image in your loop. Only you know what you have for the code on the first frame for answering this question. If this is the case then on the last frame of the animation just skip the first image by saying to go back to the frame 2 to complete.

    On the last picture:

    gotoAndPlay (2);

    If you want to repeat the frame 1 then put your stop() in a condition. Something like this:

    If (loop is nothing)

    {

    first row (var loop does not exist)

    define the var so there will be next time

    var loop: Boolean = true;

    stop at the start

    Stop();

    }

    The next time that animation refers to the Framework 1 variable "loop" will exist and the stop() will be ignored, says the head of (looping).

  • Desperately need help with AS3 and Twitter Feed!

    Hi all

    I took another developer and try to add a Twitter feed to my flash application. The twitter feed has, but only the first title and loops. It does not show the other tweets, just the first title and repeat over and over again. Please help me with this because I'm desperate to fix.

    Here is my source code for Twitter.as

    I use Flash develop to make it the main.swf, but I don't know the code below for the Twitter account is wrong because it shows more then 1 tweet.

    package src.main

    {

    import com.greensock.TweenMax;

    import com.theppc.cmstools.CmsVars;

    import com.theppc.cmstools.TextTool;

    import com.theppc.visualtools.DrawBox;

    import flash.display.MovieClip;

    import flash.display.Sprite;

    import flash.errors.IOError;

    import flash.events.Event;

    import flash.events.IOErrorEvent;

    import flash.events.SecurityErrorEvent;

    import flash.events.TimerEvent;

    import flash.net.URLLoader;

    import flash.net.URLLoaderDataFormat;

    import flash.net.URLRequest;

    import flash.text.TextFieldAutoSize;

    import flash.utils.Timer;

    Import src.utils.TitleBlock;

    import com.greensock.easing.Back;

    import com.greensock.easing.Strong;

    import of CBC. Main;

    Import src.utils.HandleXml;

    /**

    * ...

    * @author Joshua King

    */

    SerializableAttribute public class extends MovieClip TwitterBox

    {

    private var _title:TitleBlock;

    private var _bg:Sprite

    private var _width:int;

    private var _height:int;

    private var _tweetholder:MovieClip;

    private var _txt:ContentTxt;

    private var _mask:Sprite;

    private var _user:String = "PPC_Creative";

    private var _tweetcount:int = 5;

    private var _tweets:Array = [];

    private var _times:Array = [];

    private var _gap:Number = 55;

    private var _tweetmove:int = 0;

    public void TwitterBox (_w:int, _h:int)

    {

    _width = _f;

    _height = _it;

    init();

    }

    private function init (): void

    {

    _bg = new Sprite();

    addChild (_bg);

    _bg. Graphics.LineStyle(1,0x00ccff);

    _bg. Graphics.beginFill (0xFFFFFF);

    _bg. Graphics.drawRect(0,0,_width,_height);

    _bg. Graphics.endFill ();

    _tweetholder = new MovieClip();

    _tweetholder.y = 55;

    _tweetholder.x = 5;

    addChild (_tweetholder);

    _MASK = new Sprite();

    _MASK. Graphics.beginFill (0xF09FFF);

    _MASK. Graphics.drawRect (0, _gap, _width, _height - _gap - 5);

    _MASK. Graphics.endFill ();

    addChild (_mask);

    _tweetholder. Mask = _mask;

    _txt = new ContentTxt();

    _txt.txt.text = ";

    _txt.Alpha = 0;

    _txt.txt.width = 537;

    _txt.txt.height = _height - _gap - 5;

    _tweetholder. AddChild (_txt);

    addContentboxes();

    }

    private function addContentboxes (): void

    {

    _title = new cartridge (Main._sitedata ['text'] [5] .we, 547);

    addChild (_title);

    addTweets();

    }

    public function addTweets (): void

    {                    /*

    var urlReq:URLRequest = new URLRequest (_url);

    var loader: URLLoader = new URLLoader();

    loader.addEventListener (Event.COMPLETE, getTweets);

    loader.addEventListener (IOErrorEvent.IO_ERROR, IOError);

    loader.addEventListener (SecurityErrorEvent.SECURITY_ERROR, SError);

    Loader.Load (urlReq);

    */

    var loader: URLLoader = new URLLoader();

    loader.dataFormat = URLLoaderDataFormat.TEXT;

    loader.addEventListener (Event.COMPLETE, getTweets);

    var url: String = " " https://API.Twitter.com/1/statuses/user_timeline.RSS?screen_name=PPC_Creative ";

    must use a proxy due to security sandbox issues if you call this twitter url directley to flash

    var req:URLRequest = new URLRequest ("rssProxy.php? rss =", CmsVars.PHP_ROOT + url)

    trace (CmsVars.PHP_ROOT + ' rssProxy.php? rss =' + url);

    Loader.Load (req)

    }

    private void getTweets(evt:Event):void

    {

    var twitterXML:XML = new XML (evt.target.data);

    var tweetList:XMLList = twitterXML.children ();

    var tweetItem:String;

    var timeItem:String;

    var _counter:int = 0;

    _tweetmove = 0;

    _tweets = [];

    for (var i: int = 0; i < tweetList.length (); i ++)

    {

    tweetItem = cheat [i]. *: title;

    trace (tweetItem);

    If (tweetItem! = "")

    {

    _tweets.push (tweetItem);

    _Counter ++

    If (_counter > = _tweetcount)

    {

    break;

    }

    }

    }

    moveTweet();

    }

    private function moveTweet (): void

    {

    _txt.Alpha = 0;

    TextTool.setText (_txt.txt, _tweets [_tweetmove], true);

    TweenMax.to (_txt, 1, {delay: 1, alpha: 1, replace: 0});

    TweenMax.to (_txt, 1, {delay: 12, alpha: 0, crush: 0, onComplete:moveTweet});})

    _tweetmove ++

    If (_tweetmove > = _tweets.length) _tweetmove = 0;

    }

    private void IOError(e:Event):void

    {

    trace ("io error!");

    }

    private void SError(e:Event):void

    {

    trace ("security error!");

    }

    }

    }

    First of all, your cheating XMLList length is only 1. I like to use E4X rating rather than the old children() as you're here, so I might suggest to change this:

    var tweetList:XMLList = twitterXML.children ();

    in your getTweets() method to:

    var tweetList:XMLList = twitterXML.channel.item;

    Then you have all your items. I liked so much out of each of them:

    for (var i: int = 0; i< tweetlist.length();="">

    {

    trace (tweetList [i] .title);

    }

    Also, I had no trouble calling Twitter directly from Flash using:

    var loader: URLLoader = new URLLoader();

    Loader.Load (new URLRequest ("https://api.twitter.com/1/statuses/user_timeline.rss?screen_name=PPC_Creative"));

    loader.addEventListener (Event.COMPLETE, getTweets);

    However, there is a typing error in what you had posted - you had a space in the URL - after the C in C reactive...

  • A program of Photoshop for beginners help with things and advertising brochures

    What would be a good program of Photoshop for beginners help with things and advertising brochures

    ' Advertising brochures and things ' seems to imply elements that will be printed on both sides of a piece of paper or make multipage documents.

    Photoshop is an image editor and can have only 1 page per document.

    In short, Photoshop is the application bad for something more than a single item from the front.

    Adobe InDesign is a page layout program that is specifically designed to create multipage documents.

    You can type or place text, photos of the place and the other images and have better control over the placement and arrangement of the elements on the page.

    InDesign, like Photoshop, Illustrator has a steep learning curve.

    You can download Adobe trial versions (these will only work for 30 days) and raise you some books or sign for video lessons on Lynda.com

  • Need help with AS3 on Radio button Quiz

    I am trying to set up a quiz question multiple choice of radio button, but I have problems with some of the ACE and hoped that some of you could help me. I'm fairly new to ActionScript, but I'm trying to pick up quickly. The code is listed below. The lines of errors have been increased in size.

    Import fl.controls.RadioButtonGroup;


    var radioGroup1:RadioButtonGroup = new RadioButtonGroup ("QuestionC1");

    var totalScore:int = 0;

    var totalCorrect:int = 0;

    var totalWrong:int = 0;


    cpr1a.label = "" Complete a resuscitation ";"

    cpr1b.label = "" cardio a resuscitation ";"

    cpr1c.label = "" cardio a Revival ";"

    cpr1d.label = "" Complete a Revival ";"


    cpr1a. Group = radioGroup1;

    cpr1b. Group = radioGroup1;

    cpr1c. Group = radioGroup1;

    cpr1d. Group = radioGroup1;


    submit_btn.addEventListener (MouseEvent.CLICK, submitClick);


    function submitClick (MouseEvent): void {}

    If (radioGroup1.selection == null) { }

    return;

    }

    If (radioGroup1.selection.label == "Cardio a resuscitation") { }

    status_txt.text is radioGroup1.selection.label + "is correct!";

    totalCorrect ++;

    score_txt.text = "Correct number:" + String (totalCorrect) + "\n"; "."

    score_txt.appendText ("wrong number:" + String (totalWrong));

    }else{

    status_txt.text is radioGroup1.selection.label + "is incorrect. I'm sorry. » ;

    totalWrong ++;

    score_txt.text = "Correct number:" + String (totalCorrect) + "\n"; "."

    score_txt.appendText ("wrong number:" + String (totalWrong));

    }

    }

    I don't see where this error could occur except perhaps for a case where a radio AS2 is used because it seems that they do not have a group property, but an AS3 radio button.  Make sure that your publication of Flash settings are set to use AS3.  AS3 errors normally have error numbers that also made the mistake that you mentioned ring of a scenario of AS2.

    Here is a link to the file that I made based on your code that works very well and does not display the errors you mention.  It is a CS3 file.

    http://www.nedwebs.com/Flash/AS3_Radios.fla

  • With the help of text and buttons movieclips as buttons to point to the same layered framework?

    I'll have a terrible time with the 3.0 AS and animating CC 2015.2 in this project.  I was given a suggestion, but now I'm so confused output errors that I hope to get answers from you advanced people.

    The project is similar to this:

    Identify the Structure of the trees

    Framework 1 - nothing selected, visible instructions

    Frame 2 - Select sheets by clicking on the image (tree top or bottom) or text, leaves description becomes visible

    Frame 3 - branches select by clicking on the image (tree top or bottom) or text, description branches becomes visible

    Frame 4 - trunk select by clicking on the image (tree top or bottom) or text, description of trunk becomes visible


    Suggestion is:

    Do the video clip of each region of image tree and drop it on the layer smaller on top with alpha 0%

    Create a badge of the clip, and then tap on timeline with each framework has put in evidence and description

    Make the text button, then tap chronology framework with each has put in evidence and description

    Trunk frame – more small area place top layer

    Branches Frame - smaller than the leaves but superior to the place of the trunk between the two

    Framework of leaves - most square of the area on the layer under the Branches

    Can anyone offer any suggestions?  I used to program 5.5 Flash with Actionscript 2.0, but difficulties with Animate and Actionscript 3.0.  I don't know if I have to use swaps or specific images, but when viewing, he travels all frames without stopping even if each image as the AS command stop ();

    Thanks in advance!


    Rick

    Tree-Example.png

    Yes, if your buttons or movieclips, overlap one on top Gets the default click event. So, if you decide to create separate movieClips or separate buttons, be sure to give everyone an exclusive space.

    One approach I've used in the past for such things is to open the work, the tree in Photoshop then "cut" art into segments and put each segment in a different layer in Photoshop. Then you can import that art directly in to animate and each layer will import under a separate post. Then you can combine them into a movieClip to a work of art on the stage. From there, you can select each segment and each a movieClip or button you want.

  • Help with CodeSigningKey and. KEY files

    I'm having a lot of trouble trying to encrypt login information I want to store in the PersistentStore.  I tried the rest of this article:

    http://supportforums.BlackBerry.com/T5/Java-development/protect-persistent-objects-from-access-by-UN...

    But the first thing he asks you to do is to get a. Since the BlackBerry 'Administration of private key' KEY file tool.  When I ran this tool it does not enter all the information, it shows me just what looks like a dialog box public key with an Email, buttons change password and exit.  Where is the. KEY file?  It is not in the location of the file:

    C:\Program search in Motion\BlackBerry password Code signature Authority\data base

    I see an 'ID' field with a letter from four ID key, but when I use it in my application I get a result CodeSigningKey.get draw (moduleHandle, "XXXX").

    My application has files .csi for the signing of the code to enable it to run on a real phone, which works, I can't generate a .key for use of persistence file.

    Any help would be greatly appreciated!

    -Kevin.

    I have it.  It required an uninstall / reinstall in order to work.  I don't know why, but before he had a data directory, but had nothing in it and do not put anything in it.  After reinstalling, it created the data directory and place the .key file and I could continue with the steps and sign my application with my private key.

    Thank you very much for the shot, I didn't if I need a server web or not and that he feared IT would not work with Win7 64 bit.

  • Help with SmartSound and take off his

    I've been messing around with PSE10 for a few hours now and no matter what I try, I can't do audio to work right.

    First

    I have some video with my gopro from the outside of my car.  I want to remove the soundtrack of the video because it's all the sounds of wind.  It does not allow me to delete with out also delete the video.

    The other issue I'm having is with Smart Sound.

    I'm trying to get it to load so I can add a soundtrack.  I can't find how to load.

    I did the research and found this:

    b-B7E3-730C35D7EC96.html#WS8751AAF7-A228-4f11-99DA-CAF2E6A858C2 http://help.Adobe.com/en_US/premiereelements/using/WS9488D20A-A1AC-42F

    "In the menu Tools Audio in the timeline panel, select SmartSound."

    When I go in the timeline panel there is no audio tools to select. I know that I have to download the tracks first.  I can not even find out who.

    Thanks for any help right now.  I want about to take my computer and throw it out the window right now.  I have such a hard time with this software to do simple things.

    Thank you once again.

    To remove audio I usually just click with the right button, the unlink Audio and video, select the audio track, click on remove:

    For SmartSound click the "speaker" along the top of the my project Panel:

    See you soon,.

    --

    Neale

    Insanity is hereditary, get you your children

  • 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

  • Need help with as3 for pop-up window

    I'm nearing the end of the semester in my Flash Animation class. I learned things very simple AS3, extracted etc. code. I'll try to find the actionscript code to encode a simple popup window, but have not found a clue.

    Here's what I want to do... I have a white box with a certain guy on the stage. When a person clicks on the white box, I want a popup to open which is larger, which contains the same type but bigger. This box will have an x, so it may be rejected. I don't want to do it in html, only in Flash CS5. I don't want a browser window, I want just a larger version of the smaller area. I know how to build the two boxes, do not know how to write the code. I know there will be a click on the mouse event listener, and then I'm lost.

    Can someone help with the code that I could use? It would be most appreciated.

    It would be something along the lines of... (using the names of instance from your description)...

    Popup.Visible = false;

    whiteBox.addEventListener (MouseEvent.CLICK, showPopup);

    function showPopup(evt:MouseEvent):void {}

    Popup.Visible = true;

    }

    popup.popupX.addEventListener (MouseEvent.CLICK, hidePopup);

    function hidePopup(evt:MouseEvent):void {}

    Popup.Visible = false;

    }

  • Need help with drag and drop

    IM really new to this program as a

    day new hehe and I need help. im making a game quiz and your supposed

    ED to score in the hoop with a circle.  I have the

    codes for the drag and drop for the circle, but I need help with the collision between the Hoop and the ball, I want to go to the image next or gotoandPlay when the ball touches the ring. HELP PLEASE

    You should not attach code to objects.  and you can be able to happen by using a loop.

    Start by removing all the code the suggested by maqro (i.e. as3) and by removing all the code attached to objects.

    use:

    {yourobject.onPress = function ()}

    this.startDrag ();

    }

    {yourobject.onRelease = yourobject.onReleaseOutside = function ()}

    this.stopDrag ();

    {if (this.) HitTest (whatever))}

    do something

    }

    }

  • Working with XML and button

    Hello

    How are you all. Well, I'm new to Flex. But I started to build simple applications. One of the best most problem I face in working with XML and the button. Can you please help me in this. I explain my problem:

    I have an external XML file like this:
    < menu >
    < button >
    < idnt > 0 < / idnt >
    General Health < label > < / label >
    pages of < text > general health is currently under construction < / text >
    < / button >
    < button >
    < idnt > 1 < / idnt >
    < label > mental health < / label >
    pages of < text > mental health is currently under construction < / text >
    < / button >
    < / menu >

    Now, I want to generate dynamically buttons from this XML file. And the second thing that is the most problematic is that how I code so that when I press the button marked 'General health', it will display the same text as in the XML corresponding to the tag tag "< label > General Health < / label >?
    I seriously need it. I'm really confused on this. Kindly help me.

    Concerning
    .. : DeX

    Dear Peter,

    Thank you, thank you very much... bundles of thanks from me. You really help me with this. I wasn't expecting such a detailed response from anyone. But you the wrong given. Thank you very much.
    My MSN account ID is "[email protected]". I would be very happy if you add me to your contact list or let me know your email address. I am not your hotmail ID ask you many questions, would just be a friend to share new ideas and knowledge.

    I thank once again...
    .. : DW

  • HP laptop: need help with internet and search for things

    whenever I'm on chrome internet explore google ect and go to tab it is says unknown error or no internet connection or anything and just takes me chrome ect. I need help with this im involved in a byod class and my computer won't let me on what whatever usually it just starts out black and white and the seeds I my search request

    Yes it's a Windows 10 and it arrived already installed I'll take the other info now

  • Need help with WRT54G2 and network at home

    OK, I got the WRT54G for a long time and recently updated for the WRT54G2 but now can't access the file sharing and running Windows Vista from Windows XP using wireless.

    Here is my set upward,

    Desktop running Windows Vista connected to the router (that's the computer with folders and printers)

    2 - Windows XP laptop computer connected wireless

    All 3 are defined on the same workgroup can be seen on Windows XP machine when you go to, favorite network, also all can get on the internet.

    Any ideas what the problem might be? I'm guessing a setting somewhere but I was not able to find it.

    After a lot of research and help from this forum, I finally got to work, it was a firewall issue

    Thanks for the replies.

  • Need help with sizing and save files in batches

    Hi need help with a project.

    I have thousands of vector files that I need size of 350px X 350px, and then place it on a work plan x 600px-600px.

    Then I need to save it to the web as a PNG with a transparent background.

    Could I do a script for? or is there another way to do it in batches?

    I wouldn't have to open them one by one and resize the work plan then the image and save it one by one as that would take forever.

    Any help some suggestions would be greatly appreciated.

    ID do as a series of actions photoshop if the end result is png,

    pro image processor can help you make automatically, if you must resize batch additional... >

    https://sourceforge.NET/projects/PS-scripts/files/image%20Processor%20PRO/v3_2%20betas/

    I think that your work can run in a few steps, but for simplicity, I would like to start / test with a new photoshop action recording

    Open a file, change the size of the image to 350 x 350

    Change the canvas size,

    then save under...

Maybe you are looking for