Really simple button click problem...?

I've made buttons a trillion times, but this button doesn't seem to be working...
stop();
addEventListener.btn_page2(MouseEvent.CLICK, gotoPage2);
function gotoPage2(e:MouseEvent):Void {
     gotoAndPlay(99);
I've checked that the button is labeled correctly (it is).... here are the compiler errors:
Line 3 '{' expected
Line 5 Unexpected '}' encountered
What?!  Any ideas?

You couldn't have made trillions of buttons that work using that code in AS3.  It would have to be something more like the following to work in AS3...
stop();
btn_page2.addEventListener(MouseEvent.CLICK, gotoPage2);
function gotoPage2(e:MouseEvent):void {
     gotoAndPlay(99);
Switched places in the btn_page2 line and changed Void (AS2) to void (AS3)

Similar Messages

  • mx:states & button click problem.

    Hi,
    I use <mx:states> build two screen,(base state and
    screen).
    I have button on <base state>,for the click event I add
    the code like
    <mx:Button x="105" y="323" label="Button"
    click="currentState='screen1'" id="button1"/>
    But when I put the button in a mxml component and then I add
    the component on base state.
    I get error when I use the same code and click the button.
    MAIN PAGE
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute" xmlns:CTComp="*">
    <CTComp:page1 id="page11"/>
    </mx:Application>
    page1.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Canvas xmlns:mx="
    http://www.adobe.com/2006/mxml"
    width="400" height="300">
    <mx:Label x="51" y="89" text="Requestor"/>
    <mx:TextInput x="133" y="87"/>
    <mx:Button x="133" y="136" label="Login" width="103"
    click="currentState='screen2'"/>
    <mx:Label x="112" y="33" text="Catering Request Form"
    width="158" fontWeight="bold" fontSize="12"/>
    </mx:Canvas>
    How to fix the button event on mxml component?Thanks for help
    M

    To get this working correctly, you need to import
    mx.core.Application:
    <mx:Script>
    <![CDATA[
    import mx.core.Application;
    ]]>
    </mx:Script>
    Then you can access the
    Application.application.currentState='yourState' through your click
    handler:
    click="Application.application.currentState='yourState'"

  • Scrollpane scrolldrag and button click problem.

    Hi all,
         i dublicate my  movieclip named mc2. (mc2 in mc1 moviclip). And my scrollpane 's contentpath is mc1. When i do that, it works. but if i make scrolldrag = true, my button in my movieclip doesnt work.
    How can i use scrolldrag and button click in scrollpane  content ??
    thx
    Talha

    Hi,
    It works for me. i have a movie clip with button "my_btn". I placed this movie clip inside Scrollpane and enalbed scrollDrag property. I am able to drag the movie clip inside scroll pane. Also when i clicked the button inside the movie clip, i could see event handler getting triggered. I can also drag the movie clip by pressing mouse on the button.
    I am not sure whats wrong in your application.
    Thanks,
    Karthikeyan R.

  • Problem with a simple button click Xcode IphoneSDK

    not sure what i am doing wrong here. I just want a button to nslog a string.
    .h file
    #import <UIKit/UIKit.h>
    #import "PageOneViewController.h"
    @interface HomeViewController : UIViewController {
    NSString *mln;
    NSString *mls;
    @property (readwrite, retain) NSString *mln;
    @property (readwrite, retain) NSString *mls;
    -(void)selectedmln:(NSString *)themln;
    @end
    important sections of the .m file
    #import "HomeViewController.h"
    #import "Constants.h"
    @implementation HomeViewController
    @synthesize mln, mls;
    -(void)selectedmln:(NSString *)themln {
    NSArray *mlnmls = [themln componentsSeparatedByString:@"+"];
    NSLog(@"Selected MLN: %@",[mlnmls objectAtIndex:0]);
    NSLog(@"Selected MLS: %@",[mlnmls objectAtIndex:1]);
    mln = [mlnmls objectAtIndex:0];
    mls = [mlnmls objectAtIndex:1];
    - (void)viewDidLoad {
    self.title = @"View";
    UIBarButtonItem *addButton = [[[UIBarButtonItem alloc]
    initWithTitle:NSLocalizedString(@"AddFavTitle", @"")
    style:UIBarButtonItemStyleBordered
    target:self
    action:@selector(addAction:)] autorelease];
    self.navigationItem.rightBarButtonItem = addButton;
    [super viewDidLoad];
    - (void)addAction:(id)sender
    NSLog(@"Steps: %@",@"entered add item");
    self.navigationItem.rightBarButtonItem.title = @"Added";
    NSLog(@"added: %@",mln); // mln is an 8 digit number but not cast as an int
    selectedmln() get passed something like "12345678+s" from the PageOneViewController everything works fine until it comes to the NSLog event in the addAction()
    silent crash with nothing helpful in the console.
    any Ideas?
    Jason

    Oops - I overlooked that. Then the solution is:
    self.mln = whatever
    instead of what I said the first time. Using 'self' accesses the generated property. Just calling 'mln' like you were sets the instance variable directly bypassing the property method and is auto generated retain.
    And yes, as pointed out, you must still release it yourself in dealloc.

  • Simple button background problem

    Good day,
    I'm new to flex and MXML. I've gone through the initial difficulties of getting familiar with the IDE and programming language. Now that this is done, I'm really starting to enjoy it.
    I'm currently facing what is probably a basic problem. I've created an MXML Button component. When I instanciate it somewhere in another component, it comes up with a weird square background under my button, like this :
    My button is a single line component, like this :
    <s:Button label="Measure" skinClass="skins.MeasureDistanceSkin" width="70" height="25" click="OnClick(event);" creationComplete="Init(event);" />
    My button instanciation line looks like this :
    <MeasureButton map="{map}" left="110" top="42" width="80" height="33" id="MyButton" />
    Can anyone give me a hand with this?
    Thanks,
    Bruno

    You couldn't have made trillions of buttons that work using that code in AS3.  It would have to be something more like the following to work in AS3...
    stop();
    btn_page2.addEventListener(MouseEvent.CLICK, gotoPage2);
    function gotoPage2(e:MouseEvent):void {
         gotoAndPlay(99);
    Switched places in the btn_page2 line and changed Void (AS2) to void (AS3)

  • New MBA Gen 2 track pad button click problems

    Anyone else seen this: the new MBA trackpad button must be clicked firmly and almost directly in the center or it misses clicks. The previous gen MBA was not like this.
    Or is it just my unit?

    Hi Edmund,
    I received my MBA Gen 2 (1.86 GHz, 128 Gb SSD) last Friday (here in Japan) and over the course of the evening and early on into the next morning, I clearly noticed that sometimes (5 to 10%) when clicking the actually clicker button (that thin tab which is mechanical clicker and not the trackpad clicker which can be enabled through the sys prefs), it did not respond.
    This MBA Gen 2 is replacing a 5 yr old 12 inch Powerbook. Switching from the powerbook to the mba, I can clearly tell that the clicker on my MBA is a bit dodgy. In my case, the weakness seems to be to the right of center of the clicker. But then again, I'm always clicking in that area anyways, not sure if it's any better on the left or center. If I click really hard, there's no problem, but if you click lightly, it just doesn't always react, even though it has definitely "clicked".
    I called Apple Japan last Saturday and explained that this had been a problem "out of the box". Without any quibbles, they informed me that a new MBA would be ordered for me and that when it arrived, I would just have exchange the old one for the new. Only problem is, they said the delivery times are now around 2 to 3 weeks. Still, I'd rather try to get one that doesn't have this problem than not.
    As they say, misery loves company, so hope this helps.
    Regards,
    PHB

  • What's wrong? Simple button click to put input on to label

    I'm trying to build a simple application with an input box, button, and label.
    Clicking the button should take the input box contents and display it upon the label. However, although I have no bugs listed, clicking the button in the app does nothing.
    I have in my .h file:
    @interface VTViewController : UIViewController
        IBOutlet UITextField *input;
        IBOutlet UILabel *label;
        NSString *contentStore;
    -(IBAction)button;
    and in my .m file:
    #import "VTViewController.h"
    @interface VTViewController ()
    @end
    @implementation VTViewController
    -(IBAction)button
        [input resignFirstResponder];
        contentStore = input.text;
        label.text = contentStore;

    Put a breakpoint in the button method to verify the IBAction is being triggered.
    Make sure the IBOutlets are hooked up, for example it should look like this in the Connections Inspector.
    It looks like you hand-rolled this rather than Ctrl+dragging the controls into the header. Normally the IBOutlets are synthesized properties, and the button method should have a parameter.
    - (IBAction)buttonPushed:(id)sender {

  • ITS-Button Click Problem

    HI Guru's,
    I've developed a application with custom screens and i published the service using SICF.
    I'm using the Template 99.
    The Module pool application is working fine in SAP.
    IF i run it through browser, if i click on any button once, it is not working. For Example i've designed a screen like below.
    User Name :
    Password:
    LOGIN    EXIT.
    After entering the user name and password, if i click tab button, the control will come to the LOGIN Button.
    In normal SAP, if i press Enter button, the application is validating the user name and password, but in ITS, i need to click the login button twice to validate the login details.
    Thanks,
    Adi.

    BA,
    I would suggest you to change your orig screen, have you using any status on that?
    What kind of model have you been using? Classic, mobile device,etc?
    Alexandre Rocha

  • Very Urgent! Print Report output to local printer on button click in form

    In Sales Order Form there is a print receipt button. In current situation On Clicking the 'Print Receipt Button' it submits a XML Publisher report(PDF output) to the concurrent manager. Currently to print that report i need to go view--> requests--> view output and then print. According to my new Requirement i need to print that report directly to local printer on one simple Print receipt button click in form.
    I am trying to call the printers on server using custom.pll. The report is running successfully but it is not printing output to the local printer. I need to print the report to the local printers based on responsibility. Local printers are available on apps server. Can anyone help me on this issue ASAP.
    Is it possible to print the document using custom.pll? Is there any other alternative to print the report on simple button click in form.
    Environment: Apps 11.5.10.2, Forms 6i
    Here is the code that i am using in my custom.pll.
    if (v_form_name = 'OEXOETEL' --and v_block_name = 'LINES_SUMMARY'
         and name_in('parameter.ACTIONS') = 'PAYMENT_RECEIPT' )THEN
    l_organization_id := Name_In('PARAMETER.OE_ORGANIZATION_ID');
    l_order_header_id := Name_In('ORDER.header_id');
    select to_number(oe_sys_parameters.value ('SET_OF_BOOKS_ID')) into l_sob_id from dual;
    xml_layout := FND_REQUEST.ADD_LAYOUT('XXAFP','XXAFPOEXPMTRCRTF','en','US','PDF');
    select a.profile_option_value
    into v_printer_name     
    from fnd_profile_option_values a
    , fnd_profile_options b
    , fnd_profile_options_tl c
    , fnd_user fu
    where a.profile_option_id = b.profile_option_id
    and c.profile_option_name = b.profile_option_name
    and fu.user_id (+) = a.level_value
    and c.language = 'US'
    and c.user_profile_option_name='Printer'
    and a.level_id = 10003 ;
    if (FND_SUBMIT.SET_PRINT_OPTIONS(v_printer_name, 'Portrait', 2, TRUE, 'N'))
         then
    l_new_request_id := FND_REQUEST.SUBMIT_REQUEST('XXAFP','XXAFPOEXPMTRC',
    null,null,FALSE,l_sob_id,l_organization_id,NULL,NULL,l_order_header_id,
    chr(0), '', '', '', '', '', '', '', '', '', '',
    end if;
    fnd_message.set_string('Request Submitted for Custom Payment Receipt. Request ID is '||l_new_request_id);
    fnd_message.show;
    copy('NULL','parameter.ACTIONS');
    IF (l_new_request_id = 0) THEN
    FND_MESSAGE.RETRIEVE;
    FND_MESSAGE.ERROR;
    else
    l_commit_result := APP_FORM.QuietCommit;
    END IF;
    I need to complete this requirement immediately. Can anyone suggest me better ways in doing this.
    Thanks,
    Srinivas

    I solved this problem myself using shell script through custom.pll. I wrote shellscript and called that shellscript through FND_REQUEST.SUBMIT_REQUEST.It printed 2 copies to local printer.

  • Simple button problem

    I am having a real problem creating a simple button - I have
    created a Flash file using Action script 2, and when I create a
    simple button - text with a rectangle as a background, (see
    http://www.elkhavenestate.com),
    and the over state is behaving in a bizarre fashion. This is my
    first time using CS3, so is there a new control that I'm
    missing?

    I take it that it's the Home button. It appears to have a
    selectable text field or something in it, which is causing the
    problem. Either change that to a static text field or set its
    selectable property to false. The other two buttons appear to be
    fine, so maybe you can just duplicate one of them and turn it into
    the Home button.
    If I picked the wrong button, let me know.

  • Problem in refreshing JTree inside Jscrollpane on Button click

    hi sir,
    i have problem in refreshing JTree on Button click inside JscrollPane
    Actually I am removing scrollPane from panel and then again creating tree inside scrollpane and adding it to Jpanel but the tree is not shown inside scrollpane. here is the dummy code.
    please help me.
    import javax.swing.*;
    import java.awt.*;
    import javax.swing.tree.*;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    import java.awt.event.WindowListener;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    public class Test
    public static void main(String[] args)
         JFrame jf=new TestTreeRefresh();
         jf.addWindowListener( new
         WindowAdapter()
         public void windowClosing(WindowEvent e )
         System.exit(0);
         jf.setVisible(true);
    class TestTreeRefresh extends JFrame
         DefaultMutableTreeNode top;
    JTree tree;
         JScrollPane treeView;
         JPanel jp=new JPanel();
         JButton jb= new JButton("Refresh");
    TestTreeRefresh()
    setTitle("TestTree");
    setSize(500,500);
    getContentPane().setLayout(null);
    jp.setBounds(new Rectangle(1,1,490,490));
    jp.setLayout(null);
    top =new DefaultMutableTreeNode("The Java Series");
    createNodes(top);
    tree = new JTree(top);
    treeView = new JScrollPane(tree);
    treeView.setBounds(new Rectangle(50,50,200,200));
    jb.setBounds(new Rectangle(50,300,100,50));
    jb.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent ae)
              jp.remove(treeView);
              top =new DefaultMutableTreeNode("The Java ");
    createNodes(top);
              tree = new JTree(top);
                   treeView = new JScrollPane(tree);
                   treeView.setBounds(new Rectangle(50,50,200,200));
                   jp.add(treeView);     
                   jp.repaint();     
    jp.add(jb);     
    jp.add(treeView);
    getContentPane().add(jp);
    private void createNodes(DefaultMutableTreeNode top) {
    DefaultMutableTreeNode category = null;
    DefaultMutableTreeNode book = null;
    category = new DefaultMutableTreeNode("Books for Java Programmers");
    top.add(category);
    book = new DefaultMutableTreeNode("The Java Tutorial: A Short Course on the Basics");
    category.add(book);
    book = new DefaultMutableTreeNode("The Java Tutorial Continued: The Rest of the JDK");
    category.add(book);
    book = new DefaultMutableTreeNode("The JFC Swing Tutorial: A Guide to Constructing GUIs");
    category.add(book);
    book = new DefaultMutableTreeNode("Effective Java Programming Language Guide");
    category.add(book);
    book = new DefaultMutableTreeNode("The Java Programming Language");
    category.add(book);
    book = new DefaultMutableTreeNode("The Java Developers Almanac");
    category.add(book);
    category = new DefaultMutableTreeNode("Books for Java Implementers");
    top.add(category);
    book = new DefaultMutableTreeNode("The Java Virtual Machine Specification");
    category.add(book);
    book = new DefaultMutableTreeNode("The Java Language Specification");
    category.add(book);
    }

    hi sir ,
    thaks for u'r suggession.Its working fine but the
    properties of the previous tree were not working
    after setModel() property .like action at leaf node
    is not working,I'm sorry but I don't understand. I think you are saying that the problem is solved but I can read it to mean that you still have a problem.
    If you still have a problem then please post some code (using the [code] tags of course).

  • Hello i have a problem with onfocus function on ipad. i am trying to bring my cursor on a text box on a button click. It works fine with safari web browser but not on ipad. Need a solution.

    Hello i have a problem with onfocus function on ipad. I am trying to bring my cursor on a text box on a button click. It works fine with safari web browser but not on ipad. Need a solution.

    I don't think that a software update from Apple will solve the issues that you are having. You have a rogue installation. After you posted I have just done the following:
    Disk Utility can verify  my partitioned Volume (including my boot disk) AND REPAIR the non-boot disks on the same Volume without a glitch. It repairs the non-boot disks containing data smoothly.
    I have used Mail to send some mails from some Yahoo and Hotmail accounts to my Thunderbird client containing GMail accounts - absolutely normal.
    I have iLife '09 but my iMovie '09 and iPhoto '09 open in a jiffy and I see no issues here. I have 6GB RAM (Maximum) on an early 2008 Macbook Pro with a 750GB hard drive partitioned with 120GB reserved for the Boot Drive.
    I am sorry that I cannot help further but I am sure there must be a way to reinstall the software without having to revert to restoring your ML backup. I have two clones and if you have such I would attempt to do that through that rather than through Time Machine - that is of course if you have a cloned drive.
    Good luck!

  • Flash button dbl click problem

    How do I get a flash button to work on 1 click instead of dbl
    click

    It's IE-only behaviour as a result of changes Microsoft made
    several
    years ago to their browser, regarding how Active Content
    (Flash, Quicktime
    etc)
    is handled, after losing a high profile court case.
    http://blog.deconcept.com/2005/12/15/internet-explorer-eolas-changes-and-the-flash-plugin/
    Background:
    http://en.wikipedia.org/wiki/Eolas
    See also
    http://www.adobe.com/devnet/activecontent/
    If you're running Dreamweaver 8.0.2/CS3, the fix is already
    built into DW's
    interface.
    If not, try
    http://blog.deconcept.com/swfobject/
    By the way, if you want to use Flash for navigation, consider
    this -
    1. Some people don't have Flash installed - what do they do?
    2. Search engines don't parse Flash links - your site will
    not be spidered
    3. Screen assistive devices don't parse Flash links - what
    will those users
    do?
    4. DW cannot maintain links within a Flash movie, so if you
    move or rename
    a linked file, your navigation will break - what will you do?
    It's usually a very bad idea for these reasons...
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "gsnservices" <[email protected]> wrote in
    message
    news:ffbfuv$s7t$[email protected]..
    > yes, the button has a link that works, you just have to
    dbl click it. when
    > you first click you get a box around the button, click
    again and it takes
    > you to the link

  • Best way to have a button click create a pop-up window with link URL?

    Hi everyone,
    What is the best way to set a button's click to open a pop-up browser window and take the user to a specific link?
    I did a bit of research and it looks like there are many methods and I'm not sure if the posts were older, but many mention that some of the methods are inconsistent with different browsers + get caught in pop-up blockers...
    Different methods:
    navigationToURL()
    window.open()
    ExternalInterface.call()
    Many thanks,
    DK

    Just to clarify a bit: The observer pattern is not really used for "simple binding". I mean, if your application is really small, I can't say that it would hurt to implement an observer pattern just that it might be more of an overkill ( but not completely an overkill ). If the stuff you are trying to do is really simple then using simple listeners and dispatchers is fine ( even in more complex situations, events come in really handy ).
    So, don't overkill if the application is not aimed to evolve/change and be as flexible as possible. Design patterns are great when they are used correctly and in the correct situation. Just because they solve certain problems well, that doesn't mean that all applications need the complexity and abstraction many patterns bring ( you could build a simple Hello World! app in tons of classes with N patterns but what would be the point? ).
    I hope you understand what I mean. Good luck.

  • Simple button help needed!

    I want to make a simple round button that glows when you
    mouse over it and depresses when you click it.
    Apparently to do this I need to use Filters to make the glow
    and bevels. But Filtersonly work on movie clips, buttons and text.
    So I make a circle and convert it into a button symbol
    (Btn1). Then I make another button symbol (Btn2) and use the first
    button symbol (Btn 1) on the Up Over and Down frames of Btn 2.
    Assorted Filters are applied to Btn 1 on the Up Over and Down
    frames to get the effects I want.
    I test the button (Btn2) using Enable Simple Buttons. It
    works perfectly - glows on mouse over and depresses on click. Then
    I try Test Movie -- and the button doesn't work!!!
    Not does it work when exported as a SWF file!!!
    I watched a tutorial video that came with my Flash Pro 8
    Hands-On-Training (HOT) book and he used pretty much the same
    technique -- except he only tested his button with Enable Simple
    Buttons. I'll bet my house his didn't work with Test Movie either!
    The stupid thing, is I was just able to achieve exactly what
    I wanted very quickly using LiveMotion 2!
    What is wrong here? Why is it so impossible to create a glow
    button in Flash? Why has it been easy in Live Motion for years?
    All help appreciated!
    Thanks
    craig

    I thought the nesting button situation might be the problem
    BUT there is no other way to apply Filters to Up, Down, etc. Also,
    a freaking tutorial book described that as a valid method, but
    obviously it ain't.
    I tried using movieclips as well but basically had the same
    problem.
    I mentioned LiveMotion 2 because that ancient program can do
    easily what Flash Pro 8 seems incapable of.
    What is the logic behind not allowing Filters to be applied
    to simple graphics? It's absurd!
    There's got to be a way...

Maybe you are looking for

  • Why does my iMac eject my external hard drive?

    At least once a week I find that my external hard drive has disconnected from my iMac and Time Machine has not created an update. I am using the USB 2.0 connection and I never eject the drive or unplug it.  I either put my computer to sleep before wa

  • Using & in a text string

    How can I use & in a text string so that the system doesn't ask for the user to enter a value. eg the string is Joe Blogs & Co. Currently the system asks for the user to enter text.

  • Making a button invisible with ActionSctript 3?

    I have one button instance that stretches across many frames, and I would like to make it invisible in some of the frames and visible in others. How do I do this with ActionScript 3? thanks

  • ME21 PO User Exit

    Hi, Can any one help me for user exit in t-code ME21N  PO. I want get the Vendor Telephone from and update it in Communicatio tab at header level when  I enter a value For Vendor field. Please help me out in this

  • Mulitple logon prompt not showing

    Hi all, We have 4 apps server include the CI. Normally during 2nd or more logon to the system, SAP will normally pop up a message saying something like "This user had currently loggon....." etc irreguless of whether multiple logon is allowed. In my C