Solved

Button Problem

Posted on 2004-10-26
158 Views
Last Modified: 2010-04-03
I am very new to flash. I created a forms application and places some buttons on the application screen. I named them home_btn and search_btn. The problem is when I click on them they should take me to Home and ShowSearchMenu.

I assigned Behaviors for them. The home button click event goes to slide Home and the Search button click event goes to slide ShowSearchMenu.

Any idea of why they wouldn't work? I just threw this app together. I am working on moving over to ColdFusion/ASP.net backend with a Flash front end.
0
Question by:JoshDale
    14 Comments
     

    Author Comment

    by:JoshDale
    If you would like to take a look at this app, I can put it up on a ftp site.
    0
     

    Author Comment

    by:JoshDale
    http://www.pcfloans.com/testapp
    It is the Document Management.fla file
    0
     
    LVL 39

    Expert Comment

    by:blue-genie
    Hi.
    From what I can see, your problem lies in the following:

    if (screen instanceof mx.screens.Slide) {

    you define var screen = null - but you've not specified a datatype for screen, if you comment out your if statement, it loads the slides, as I see it, the screen is not of type Slide so um... never true, thus button appears not to work.

    blu.
    0
     

    Author Comment

    by:JoshDale
    Still doesn't work. Keep in mind I created this application in Flash MX 2004 Professional and that the code generated was not written by hand.
    0
     
    LVL 39

    Expert Comment

    by:blue-genie
    what do you mean by that?
    0
     

    Author Comment

    by:JoshDale
    I created the button then I clicked on it, went to the behaviors pannel, clicked the plus sign, clicked screen, clicked go to slide, selected the slide home and clicked ok.
    That is the process I went through creating the button.
    0
     
    LVL 39

    Expert Comment

    by:blue-genie
    Personally, i don't use slides or behaviours, so i'm not very clued up on those, but i just opened your example. I gave it a go, and I used the "show screen" behaviour rather than the go to behaviour and it works.

    so try that.
    0
     

    Author Comment

    by:JoshDale
    Yea, the only problem is, when I click a button and then another button, the content from the button before is still displayed.
    0
     
    LVL 39

    Expert Comment

    by:blue-genie
    why dont' u write your own code,
    when a button is pressed, check if the destination screen is the current one, if yes do nothing, else hide current screen and show new one.
    0
     

    Author Comment

    by:JoshDale
    I am new to doing this, the way I learned was using behaviours and having flash do the rest.
    0
     
    LVL 39

    Expert Comment

    by:blue-genie
    maybe someone with experience with behaviours can help you out then

    sorry.
    0
     

    Author Comment

    by:JoshDale
    Thanks
    0
     
    LVL 5

    Accepted Solution

    by:
    Hi Josh,

    Slide behavior won't work since you're using a form application. You can try this script:

    For home_btn:

    on (click) {
          _parent.Search.visible = false;      
          _parent.Home.visible = true;
    }

    For search_btn:

    on (click) {
          _parent.Home.visible = false;
          _parent.Search.visible = true;
          _parent.Search.ShowSearchMenu.visible = true;
    }
    0
     

    Author Comment

    by:JoshDale
    Ok, that works. There is one problem though, I stuck the navigation on the application screen, how can I set visible = false; for all layers but the one triggered? Do I manually have to put visible = false; for every layer?
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone. Privacy Policy Terms of Use

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
    I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
    The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
    The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

    877 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now