logo-dw

Go Back   Dreamweaver Club Forums > Graphic Design > Flash
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 12-07-2007, 07:57 PM   #1
cocoonfx
cocoonfx's Avatar
 
Join Date: Nov 2006
Location: Tamworth,UK
Posts: 576
Default loadmovie command not working in if statement

Hello Chaps


I have been building a little flash widget for a site, i can get the form part to work correctly no problems, but i want to have a small little .swf to play within the widget if a condition is meant. I.e if i enter the details in the form it does a calculation say = 28. Some text appears and then i want the swf to appear related to this condition. However when i type a number into one of the form fields the swf starts to play and when the form actually equals 28 the .swf disappears.

My code is as follows:

Code:
kgs = 0;
cm = 0;
_root.onEnterFrame = function() {
var cal:Number = Number(cm*cm);
var b:Number = Number(kgs/cal*10000);
bmi = Math.floor(b);

if (bmi>=5 && bmi<20.00) {
txt = "Status: Underweight You should not lose any further weight and should consider increasing your consumption of a healthy diet to increase your BMI reading.";
}
if (bmi>=21 && bmi<=25.00) {
txt = "Status: Congratulations your BMI result is showing you within the healthy range.You should maintain your weight, take regular exercise and seek a consultation on a healthy weight maintenance program.";
}
if (bmi>=26 && bmi<=30.00) {
txt = "Status: Overweight -- You are a little over the recommended weight for your height. If the weight has been creeping on slowly then now is a good time to have a serious re-think before it becomes a problem. Seek a consultation.";
loadMovie("mt.swf",this.target);

}
if (bmi>=31.00 && bmi<=40.00) {
txt = "Status: Clinically obese 1 You need to take a serious look at your lifestyle. Determine your waist circumference by placing a measuring tape snugly around your waist. Risk factors for heart disease and other diseases increase with a waist measurement of over 40 inches in men and over 35 inches in women.";
}
if (bmi>=40.00 && bmi<=100.00) {
txt = "Status: Extreme Obesity Advise urgent check up with doctor and then under doctor advice commence an immediate health program to reduce weight and improve overall fitness. Seek an immediate consultation.";
}
if (bmi>=100.00) {
txt = "Please enter your height in centimeters and your weight in KGs i.e Height = 181 and Weight = 92.3";
}
};
stop();
Any ideas on how to make this work?

Last edited by domedia; 12-07-2007 at 08:04 PM.. Reason: code tags
cocoonfx is offline   Reply With Quote
Old 12-07-2007, 08:22 PM   #2
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

would it not be better to send the play head to another frame and load the movie on that frame

Code:
 
if (bmi>=26 && bmi<=30.00) {
txt = "Status: Overweight -- You are a little over the recommended weight for your height. If the weight has been creeping on slowly then now is a good time to have a serious re-think before it becomes a problem. Seek a consultation.";

goto_and_stop(2)

}
then in frame2 load your movie
__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Old 12-07-2007, 10:23 PM   #3
cocoonfx
cocoonfx's Avatar
 
Join Date: Nov 2006
Location: Tamworth,UK
Posts: 576
Default

Yes that would work....

I will do that but there must also be away to get the if statement to work....

Thanks DJ
cocoonfx is offline   Reply With Quote
Old 12-08-2007, 07:21 AM   #4
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

im not sure but i would do it my way
__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Reply


Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:43 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com