Close button for swf in flash

Posted on 2008-11-16
Last Modified: 2013-11-11
I am creating a flash website and within the site, i am using another flash file for the calendar feature. I have the code to pop-up the calendar (swf) on the correct page, but now I am in need of a close button.

I have created a flash button with the three different states and hit area in the .fla file of the calendar, but the actionscript is the issue. It needs to be able to close the individual swf (calendar) without affecting the rest of the flash website.

I'm not even sure if creating the button on the calendar file is the right way to do this, or creating the button on the website file and pointing it to the swf of the calendar.

I hope this explains my problem. Let me know if you have any additional questions. Thanks in advance.
Question by:TCUBusiness09
    LVL 39

    Accepted Solution

    how you remove the swf depends greatly on how you loaded it.
    but if you put the button inside the calendar swf,
    do this.
    on (release) {
    trace(this);//check if this references the calendar if not modify based on the trace result i.e _parent etc


    Author Comment

    Thanks! I'll try this code out later today and get back to you on how it worked.

    Author Closing Comment

    That worked perfectly. Exactly what I wanted. Thanks!

    Author Comment

    One other question that I do have is now that I have loaded the calendar using:

    on(release) {
    loadMovie ("calendar8_01.swf", 1);

    How do I position the new window where I want it within my flash site. It is loacated by default in the top left corner, but I am wanting it to be in the middle of the screen both horizontally and vertically. Is this possible?

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Suggested Solutions

    I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
    Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
    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.
    The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

    759 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

    10 Experts available now in Live!

    Get 1:1 Help Now