Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > Extensions and Plugins > Components

Reply
 
Thread Tools Rate Thread Display Modes
Old 05-09-2003, 03:29 AM   #1
bnnwabu
Registered User
 
Join Date: May 2003
Location: State of KS
Posts: 4
Question My calendar popup NOT working? Help...please

What am I doing wrong?

i have a main movie that has a button symbol next to a textfield. When the button is clicked, a calendar pops up allowing a user to select a date. That date is then displayed in the textfield next to the button. (Works great the first time, but the subsequent times when the button is clicked, the calendar pops open for a second and closes before a user gets a chance to select a date.

This is how i created the calendar:
1. Created a movie with the calendar from the Flash UI set 2
2. saved it as a movie symbol
3. embedded the symbol into my main movie
4. This code is in my main movie, it opens the calendar when the button-symbol is pressed:

calbtn.onPress = function() {
trace("i've been clicked");
tellTarget("calendarPanel"){gotoAndStop(5);}
}

5. This function is in the action layer of my calendar symbol:
function CalFunc(){
selectedDate = calcontrol.getSelectedItem();
Mnth= selectedDate.getMonth() + 1;
trace(Mnth);
yr=selectedDate.getFullYear();
trace(yr);
dd=selectedDate.getDate();
trace(dd);
if (Mnth < 10){Mnth = "0"+ Mnth}
if (dd < 10){dd = "0"+ dd}
NewDate = Mnth + "/" + dd + "/" + yr;
trace("date" + NewDate);
_level0.StartDate_txt.text=NewDate;
calcontrol.setChangeHandler("");

gotoAndStop(1);//hide the calendar
}
stop();

6. The function above is the changehandler for my calendar symbol.

Like I said above, it opens fine the first time and sets the selected date on the text field, but next time the button is clicked, the calendar opens and closes and the trace information displays May 1st instead of the current day.

Any help is greatly appreciated.
Thanxx in advance
bnnwabu is offline   Reply With Quote
Old 05-09-2003, 10:42 PM   #2
RVK
Senior Member
 
Join Date: May 2003
Posts: 187
Default

as I understand you,

tellTarget("calendarPanel"){gotoAndStop(5);}

this line displays the calendar.

gotoAndStop(1);//hide the calendar

and obviously this one will hide it.

I would do this as a more reliable method of displaying an object.

in calendarPanel you just need ONE frame which has the calendar visible on it.

then use this to display:

calendarPanel._visible = true;

then use this to hide it:

calendarPanel._visible = false;

You're original method "might" be the cause of your glitch.

I'll give your method a try in flash when I get home today.

-R

Last edited by RVK; 05-09-2003 at 10:49 PM.
RVK is offline   Reply With Quote
Old 05-09-2003, 10:45 PM   #3
RVK
Senior Member
 
Join Date: May 2003
Posts: 187
Default

Another idea I just had was this ---

in the onPress function you have this :

tellTarget("calendarPanel"){gotoAndStop(5);}

this is telling calendarPanel to go to and stop on frame 5

however to hide you do this :

gotoAndStop(1);

this is telling the current timeline to go to frame 1 leaving calendarPanel to stay on 5 after the first time you click it.

Sooo, I would definately recommend trying the method from my above post.

-R
RVK is offline   Reply With Quote
Old 05-10-2003, 07:57 PM   #4
bnnwabu
Registered User
 
Join Date: May 2003
Location: State of KS
Posts: 4
Default

RVK,
I will give your method a try within the next 10 minutes and post the outcome.

CyanBlue,
Would you like me to attach the fla file? or the code? The code is what I posted with my original email.

Thanks all in advance.
B
bnnwabu is offline   Reply With Quote
Old 05-10-2003, 08:49 PM   #5
bnnwabu
Registered User
 
Join Date: May 2003
Location: State of KS
Posts: 4
Default

RVK,
I gave your method a try, still not corporating. Here is what i did.

In my calendar movie, i have only one frame showing the calendar and this code is the event handler for the calendar:

function CalFunc(){
selectedDate = calcontrol.getSelectedItem();
Mnth= selectedDate.getMonth() + 1;
trace(Mnth);
yr=selectedDate.getFullYear();
trace(yr);
dd=selectedDate.getDate();
trace(dd);
if (Mnth < 10){Mnth = "0"+ Mnth}
if (dd < 10){dd = "0"+ dd}
NewDate = Mnth + "/" + dd + "/" + yr;
trace("date = " + NewDate);
_level0.StartDate_txt.text=NewDate;
calcontrol._visible=false;
}
stop();



Then in my main movie, at the site initialization script i make the calender invisible with this code:

calendarPanel._visible=false;

Then the onPress event of my button that opens the calendar is as follows:

calbtn.onPress = function() {
trace("i've been clicked");
calendarPanel._visible=true;
}

Works fine the first time, get the date clicked by user and displays it in the textfield, however, when i click the button again, the trace information shows fine, but the calendar doesn't make itself visible again.

Help please



UPDATE
Instead of making my calendar a movie, i just place a calendar control on my main movie then using a push button control, i open and close the calendar. I have been able to do it successfully each time.

I was hoping to use the calendar as a symbol so that i can encapsulate the code for the calendar since i have 3 other similar movies that would utilize the calendar. The way i have it now, i would have to place the calendar in each movie and copy paste my code.

I really would like to get it to work the original way but since I'm new to flash, I'm counting on all you gurus out there :-)

Thank you
B.

Last edited by bnnwabu; 05-10-2003 at 09:07 PM.
bnnwabu is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:38 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.