One button, multiple functions

Hello.
I have used the loader script to load an external swf into current project. I have added a button to unload the external file when wanted, and was wondering if you could have multiple functions for that button, so that when you click it to unload it works as a 'home' button as well, and takes the user back to the mainpage again?
AS3 btw.
Might be wise to mention that im kinda new to adobe flash and as3, and not sure if the way i have used to load the external swf was the easiest. Seems like a few have had some issues with this subject before me as well.
All pointers in the right direction is appreciated. Cheers.

Thanks alot for answer Ned Murphy.
As I've might failed to mention, is that the button is intended to do two things, unload and return to main page, at the same time. So basically a one click operation.
To update the situation, I've tried this as a code;
btnHeim.addEventListener(MouseEvent.CLICK,unloadSwf);
function unloadSwf(e:MouseEvent):void {
    loader.unload();
btnHeim.addEventListener(MouseEvent.CLICK,tilbaks);
function tilbaks(event:MouseEvent):void{
    gotoAndStop(1,"Mainpage");
It kind of work, as it unloads and takes you back to the main page. Only thing then is that the buttons on mainpage doesnt work any longer, and one of them disappear?
I've never been this deep into AC3 i think, so not sure what the problem is, except for the fact that there is some issues going on.
This is the error that shows up on 'output' after btnHeim is clicked.
TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at Mappevurdering_web_fla::MainTimeline/frame2()
    at flash.display::MovieClip/gotoAndStop()
    at Mappevurdering_web_fla::MainTimeline/tilbaks()
Thanks again

Similar Messages

  • One Button Multiple URL call's

    I have a Button that "Redirect to URL".
    This works and results in the generation of a PDF that is downloaded to the users download dir.
    Now there is the requirement to be able to select multiple values ( records) on a page and then after pressing a button generation separate reports for each selected value.
    I think this can be don using a Dynamic action, but I have no idee how to do this.

    1. What is the best practice to route URL's to its unique landing page prior to client login?What you need is virtual hosting.
    See http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/High%20Availability%20Guide#section-High+Availability+Guide-TheBigPicture for details.
    2. From a webserver perspective, what are the options to route URL requests to the appropriate Web Space "entry points" i.e. would one set this up in Apache, Glassfish, or Web Space and how?See my first comment. It can be handled in the web server(tomcat)
    3. What are the options to customise each landing page to have its own unique look and feel?Each community can have its own look and feel.
    See http://docs.sun.com/app/docs/doc/820-7054/ghycy?a=view to know how to do this.

  • How to give a button multiple functions

    So I have a button for audio which plays it and a button that stops the audio. What would I need to do with the actionscripting to hide the play audio button when the music is playing and just show the audio off button, and then hide the off button when it's clicked and show the play button in its place?

    import flash.events.MouseEvent;
    play_btn.addEventListener(MouseEvent.CLICK, playFunc);
    stop_btn.addEventListener(MouseEvent.CLICK, stopFunc);
    play_btn.x=stop_btn.x;
    play_btn.y=stop_btn.y;
    stop_btn.visible=false;
    function playFunc (e:MouseEvent):void {
        play_btn.visible=false;
        stop_btn.visible=true;
        //the code to play
    function stopFunc (e:MouseEvent):void {
        stop_btn.visible=false;
        play_btn.visible=true;
        //the code to stop

  • Multiple functions in one button

    Good evening,
    Is it possible to run multiple functions with one button?
    For example: With a button to open and close an object?
    Thanks 

    Hi Rinku,
    This is an example for you:
    A Piano Key Control in C#
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to keep multiple function modules under one Web service

    Hi Experts,
    I have Three RFC function modules and i need to create one web service for these three RFC function modules. I know How to crearte a web service for one function module.
    please suggest me How to keep multiple function modules under one Web service.
    Thanks in advance
    Lakshminarayana

    Hi Lakshmi,
    The best way to do it is to assign all the three RFC Enabled FM's to one function group. Later on the top menu in Utilities you get an option to Create a Webservice from a Function Group.
    You can create one single Webservice using all the the 3 FM's.
    I hope this helps.
    Thanks,
    Manu

  • Multiple sounds in one button

    would you kindly give me a suggestion that how to make multiple sounds in a button of a windows form application. actually, being a newb i'm trying to develop a piano application by C# for my own interest. the problem is, when i press one button it plays
    too long & i had to wait until the wav file is finished & after that i had to press another button. what's the code for playing multiple sounds together in one button? u know, then i can play chords too. would you kindly explain or give a code?

    Hi Rinku,
    This is an example for you:
    A Piano Key Control in C#
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Dynamically adding multiple instances of a movie clip to the stage with one button

    hello,
    I was wondering if there was a way to add several instances
    of the same movie clip to the stage dynamically utilizing one
    button.
    I can do one with the following code placed on the button...
    on (release) {
    attachMovie ("filledCircle", "filled1", 5);
    filled1._x = 370;
    filled1._y = 225;
    But I want the user to be able to hit the button again and
    get yet another instance of "filledCircle" on the stage.
    I also want the user to be able to drag these instances
    around...
    Any help would be appreciated...
    Thanks,
    Muhl

    Muhl,
    > I was wondering if there was a way to add several
    > instances of the same movie clip to the stage
    > dynamically utilizing one button.
    Sure thing.
    > I can do one with the following code placed on the
    > button...
    >
    > on (release) {
    > attachMovie ("filledCircle", "filled1", 5);
    > filled1._x = 370;
    > filled1._y = 225;
    > }
    Gotcha.
    > But I want the user to be able to hit the button again
    > and get yet another instance of "filledCircle" on the
    > stage.
    You're in luck, because this isn't very hard to do. The main
    thing to
    keep in mind is that each instance must have A) its own
    unique instance name
    and B) its own unique depth. In your example, the instance
    name is filled1
    and the depth is 5. The next clip's instance name should be
    filled2 at a
    depth of 6. Then filled3, depth 7, and so on. You can use a
    single
    variable to handle the incrementation.
    // code in a frame
    var counter:Number = 1;
    // code on your button
    on (release) {
    attachMovie ("filledCircle", "filled" + counter, counter +
    4);
    With me so far? The variable counter contains the numeric
    value 1. The
    second parameter of attachMovie() is provided with a
    concatenation of
    "filled" + 1, which makes "filled1". The third parameter is
    provided with
    the sum of counter plus 4, which makes 5. Obviously, we need
    a bit more.
    The button must, in addition, increment the value of counter.
    The ++
    operator handles this perfectly.
    on (release) {
    attachMovie ("filledCircle", "filled" + counter, counter +
    4);
    counter++;
    Now, it seems you also want to position the attached movie
    clip to (370,
    225). Are they call supposed to go to the same place? If so,
    you may use a
    second variable to hold a reference to the newly attached
    clip. Look up
    MovieClip.attachMovie(), and you'll see that the method
    returns the exact
    reference you need.
    // code in a frame
    var counter:Number = 1;
    var mc:MovieClip;
    // code on your button
    on (release) {
    mc = attachMovie ("filledCircle", "filled" + counter,
    counter + 4);
    counter++;
    mc._x = 370;
    mc._y = 225;
    Make sense?
    > I also want the user to be able to drag these instances
    > around...
    Then you need to handle a few events. You're dealing with
    movie clips
    here, so your best bet is to study up on the MovieClip class,
    which defines
    all movie clips. (Note, also, that the TextField class
    defines all input
    and dynamic text fields; the Sound class defines all sounds,
    etc. This is a
    very handy arrangement of the ActionScript 2.0 Language
    Reference.)
    // code in a frame
    var counter:Number = 1;
    var mc:MovieClip;
    // code on your button
    on (release) {
    mc = attachMovie ("filledCircle", "filled" + counter,
    counter + 4);
    counter++;
    mc._x = 370;
    mc._y = 225;
    mc.onPress = function() {
    this.startDrag();
    mc.onRelease = function() {
    this.stopDrag();
    Easy as that. You're simply assigning a function literal to
    the event
    of each new MovieClip instance as you create it. Take a look
    and you'll see
    each of these class members available to you -- that is, to
    all movie clips.
    MovieClip.onPress, MovieClip.startDrag(), MovieClip._x, etc.
    Wherever it shows the term MovieClip in the Language
    Reference, just
    replace that with the instance name of your clip -- or a
    reference to that
    clip (which even includes the global "this" property).
    David
    stiller (at) quip (dot) net
    Dev essays:
    http://www.quip.net/blog/
    "Luck is the residue of good design."

  • Submiting multiple forms with one button

    I have a form that has a cfform within it. The cfform has a
    cfloop in it that includes an id and a dropdown list box that
    includes a new id. I want to transfer one id to another. I want the
    user to be able to click on one button that would update all the
    rows in the table with the new id.
    If there are 3 rows in the query, the user would select an
    entry in a dropdown for each row and upon clicking on the submit
    button all three rows would be updated with the id selected from
    the dropdown.
    Any suggestions?
    Thanks for the help!
    Gary

    There isn't a way to set this up using the Paypal payment integrated into FormsCentral using seperate forms for each child, you can set up one form so they can register additional children and then pay in one session, but if you need each child to be a unique form submission it can not be set up to pay for multiple at once.
    Thanks,
    Josh

  • One button controlling multiple buttons as3

    I'm trying to follow a tutorial I found online for a randomly selected image without using an XML or AS file.
    The problem is that I want to generate more than just one section, like generate an image from one group, and an image from another group, and etc etc. That's something I can do but there'd need to be a button for each group. It's not exactly horrible, but I was hoping to just have a "one button controls everything". So is there a basic code that will say "When this master button is clicked, all these other buttons are clicked"?
    Here's the tutorial for reference.
    Flash Tutorial: Generate a Random Frame with AS3 -HD- - YouTube

    One approach is to have the event handler of the button call all of the other button's event handler functions, passing its received event argument to them.  If you were to name the other functions in some numeric  pattern then you could loop thru them rather than writing each one out separately.
    Another approach would be to have one single function that works for all the buttons where you test which button was clicked and decide which commands to execute.

  • Are these a lot of functions for one button?

    i'm something of a novice, just wondering if someone could
    tell me if this looks like a lot to have on each of my seperate
    menu buttons (i realise it may not mean much without knowing how
    big the loadMovies are etc, but just in terms of the number of
    seperate actions/functions per button)
    each buttons has (similar):
    digitalBtn.onRelease = function() {
    setTimeout(backgroundDigital,1500);
    setProperty("blockout_mc", _visible, "0");
    my_ssp.loadAlbum("digitalplanet");
    loadMovie("logos/dp_logo.gif", logoHolder_mc);
    function backgroundDigital() {
    loadMovie("backgrounds/bg_digital.swf", bgHolder);
    many thanks,
    Ray

    Thanks Shane.
    that's actually what i'm doing (for the first time) - didn't
    mean to say that each action is specifically sitting on the button.
    what i'm asking though is if having several different
    functions/actions being called by each of my buttons is a problem -
    each buttons loads 2 movie clips, changes the property of another
    movie clip, and has the setTimeout function, and tells a component
    to load something as well.
    so each of my menu buttons is calling 5 different
    actions/functions - just wondered if that is a lot or if it matters
    at all how many different actions are assigned to one button.
    cheers
    Ponch

  • How can I get one button to perform two functions?

    here's what I want:
    have one button with a + that opens a pop up using a MSO and then turn that button to a X to close the pop up changing states on the MSO

    1. Create a graphic with plus sign and make it a button
    2. Group it with an empty frame of desired size
    3. Create a graphic with x sign and make it a button
    4. Group it with a frame with a pop up
    5. Create an MSO of the two groups
    6. Assign "goto next state"  to each button

  • Need ONE Button That Controls Audio/Caption for Multiple Movies

    Captiate Version: 3
    Flash Version: 9
    We created an online course using Captivate 3. The shell is HTML and the captivate (.swf) is embeded to show the content. Because the content inside the captivate movies were too large we had to break up the course into separate pages for loading purposes.
    For example:
    HTML Page            Captivate File
    page001.html         page001.swf
    page003.html         page003.swf
    page004.html         page004.swf
    Now we need a way to use ONE Button to control the Audio/Caption for ALL the movies. The button would be included seperately in the HTML shell along with Captivate movie.
    Is this possible? If so please let us know in detail how?
    We're open to other ideas. We are somewhat familar with using Captivate variables ect is required.

    You can control Captivate SWFs via JavaScript using the CaptivateController. It allows you to control all the standard Captivate variables from HTML.
    http://pipwerks.com/2010/08/23/captivatecontroller-updated-to-support-adobe-captivate-5/

  • Executing multiple methods off of one button

    Hi,
    I have a parameter form based on the bind variables of a view object and I am trying to execute a second method via the "ExecuteWithParams" buttons.
    I have included an <f:actionListener/> within my command button so my current button code is as follows:
    <af:commandButton actionListener="#{bindings.ExecuteWithParams.execute}"
    text="Submit"
    disabled="#{!bindings.ExecuteWithParams.enabled}"
    action="Go" partialSubmit="false">
    <af:setActionListener from="#{bindings.Param1.inputValue}"
    to="#{Input.Param1}"/>
    <af:setActionListener from="#{bindings.Param2.inputValue}"
    to="#{Input.Param2}"/>
    <af:setActionListener from="#{bindings.Param3.inputValue}"
    to="#{Input.Param3}"/>
    <af:setActionListener from="#{bindings.Param4.inputValue}"
    to="#{Input.Param4}"/>
    <f:actionListener type="model.InputBean"/>
    </af:commandButton>
    model.InputBean:
    public class InputBean extends AppModuleImpl implements ActionListener{
    ....... (includes sets and gets for Input.Param1-4)......
    public void processAction(ActionEvent e){
    FacesContext fc = FacesContext.getCurrentInstance();
    ValueBinding vb = fc.getApplication().createValueBinding("#{data}");
    BindingContext bc = (BindingContext)vb.getValue(fc);
    DCDataControl dc = bc.findDataControl("AppModuleDataControl");
    ApplicationModule am = (ApplicationModule)dc.getDataProvider();
    AppModule service = (AppModule)am;
    service.Method(Param1, Param2);
    The service.Method() is called but errors out with a nullPointerException at both parameters.
    I've hard coded the method and found it does work, I am just having trouble passing the variables in to start with.
    The setActionListeners within the button code are so I can pass the values that are entered in each Param to the next page, I thought I might be able to
    use these to set the Params for service.Method() but it seems this isn't happening.
    Any Ideas?
    Thanks,

    Hi,
    That has helped, I was able to execute my second method and redirect to the other page on the one button submit
    but now my view objects that I dropped from the data control palette don't return any rows.
    Any ideas?
    Thanks,
    Not sure what I did, but it started working!
    Edited by: Ruari on May 21, 2009 11:26 AM

  • Can we perform two actions with one button with two clicks one after other?

    Sir,
    can we perform two actions with one button with two clicks one after other?
    I want that when I click an Add Button first time it add data to the database and when I click again this button it clear the form data to empty fields.
    Regards
    Tanvir

    In code it should be easy.
    The following code adds a button called butman with a text "ADD".
    It then registers a listener that will be called if the button is clicked.
    This listener then calls the runAddData method if you clicked on butman while it contained the "ADD" text and it will call the runClearData method otherwise.
    Therefore it will swap the button's functionality between ADD and CLEAR on every click.
    final Button butman = new Button("ADD");
    butman.setOnAction(new EventHandler<ActionEvent>() {
              @Override
              public void handle(ActionEvent t) {
                        if (butman.getText().equals("ADD")) {
                                  butman.setText("CLEAR");
                                  runAddData();
                        } else {
                                  butman.setText("ADD");
                                  runClearData();
                        } // END IF-THEN
              }});I hope this is what you wanted.
    Some extra food for thought.
    You might want to run the ADD and CLEAR methods in their own threads so that it can run in the back ground, without slowing down your user interface.
    I also like to rather reuse one button for multiple functionality in stead of making an application with hundreds of nodes only used rarely with masses of code to show and hide them if needed.

  • How can I do to code the equivalent of: Wait ... until(click one button)?

    Thanks to answer me and to send me a little code which explains the solution.
    A French guy.

    If you have to display a panel and wait for the user to click one button to proceed, you could use GetUserEvent ().
    I use it when I have to disply a popup panel
    different from MessagePopup or PrompPopup or similar and I don't want to deal with a separate callback to manage controls on that panel. Here you find an example: I display a popup for the user to input a password (using the password control in toolbox to display an input string with the usual '*****' pattern while typing).
    pwH = LoadPanel (0, UIR, pwd);
    InstallPopup (pwH);
    PasswordCtrl_ConvertFromString (pwH, pwd_pw);
    errChk (PasswordCtrl_SetAttribute (pwH, pwd_pw, ATTR_PASSWORD_MAX_LENGTH, 12);
    while (TRUE) {
    GetUserEvent (1, &pnl, &ctrl); // Program waits until a button pressed
    // Here when a button
    have been pressed
    if (ctrl == pwd_quit) { // 'Abort'
    button
    // Exit from function, close popup...
    PasswordCtrl_GetAttribute (pnl, pwd_pw, ATTR_PASSWORD_VAL, pw); // Read password
    if (strcmp (pw, correct_password))
    MessagePopup ("PASSWORD",
    "Incorrect password. Retry.");
    else
    break; // Correct password
    RemovePopup (0);
    I use it where I don't want to exit from the actual function to manage the 'Ok' button from the popup panel elsewhere.
    Hope this helps
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

Maybe you are looking for

  • Good tools to use in testing and overclocking

    CPUz A64 Tweaker Clockgen K8T Neo2 must use version #CG-ICS950405 SiSoft Sandra Everest HD Tach 3 Memtest86 Speedfan HiJack This PCI Latency Tool Prime95 3dMark 01, 03, 05 and PCMark 02, 04 PassMark Performance Test V5.0 30 Day Trial Lavasoft Adaware

  • Partial billing against sales order

    Hello gurus, is there anyway to set up partial billing. By partial billing I mean if I have a sales order for 400 pieces of one item, can I make a billing document for 200 pieces of such item save it and then come back to do another billing document

  • Delete A Large Number of Randomly Distributed Duplicate Pages

    Hello Sir, I have a pdf file with as many as 10,000 pages, which actually should has 6,000 pages. The extra duplicate 4,000 pages are randomly distributed in the file without any discipline. Do we have such as tool can scan, compare and pick out the

  • Class to Generate Dynamic Filter Function

    I have built an ActionScript Class to allow me to create a dynamic Filter Function for the several ArrayCollections I use in my Flex Application. It works just as I intended, however, I'm wondering if it's too verbose, and can be skimmed down to use

  • Can't install photoshop CS4

    I am using windows XP SP3 and tried to install photoshop CS4 many times. But every time, after a certain extent of the completion of the setup, my system automatically restarts. I checked the setup log file and found that the last line of the log fil