A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Flash code needed...

  1. #1
    Member
    Join Date
    Oct 2006
    Posts
    35

    Flash code needed...

    I'm wondering if anyone knows of any coding that will allow the user to input a date of her conception and after the OK button is pressed, the user is shown a picture of the fetus after that many weeks have passed. Make sense?

    Thanks for all your help!

  2. #2
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    I dont see why not.

    the only thing you'd really have to do is figure out how many 'weeks' its been..and then show a 2, 6, 12, 18, 48...week image...correct?

    the date class is a little lacking but you might be able to use it..

    if not..maybe a custom class like xDate or something.. has a few more features/functions for you to use..


    actually this should work for you

    you'll obviously have to take the vars at top and grab them from an input field or drop down box or however you plan in getting the data from the 'parent'..

    you'll obviously have to add in the load image portion yourself..Im not sure if you want to get url..or load the image into a specific container clip... using a movieClipLoader() instance or what..

    PHP Code:
    var conMonth:Number 0//0 = January
    var conDay:Number 1;
    var 
    conYear:Number 2009;

    var 
    conDate = new Date(conYearconMonthconDay);
    var 
    currDate = new Date();

    //convert difference in milliseconds to days
    var inDays Math.floor((currDate conDate) / 86400000);
    //convert difference of days to weeks
    var inWeeks inDays/7;

    //output
    trace("DAYS: "+inDays);
    trace("WEEKS: "+inWeeks);
    trace("ROUNDED: "+Math.round(inWeeks));

    switch (
    Math.round(inWeeks)) { 
     case 

     
    trace("Baby @ 0 weeks"); 
     
    trace("No image availabe for this time frame");
     break; 
     case 

     
    trace("Baby @ 1 week"); 
     break; 
     case 

     
    trace("Baby @ 2 weeks"); 
     break;
     case 

     
    trace("Baby @ 3 weeks"); 
     break;
     case 

     
    trace("Baby @ 4 weeks"); 
     break;
     default : 
     
    trace("No image available for this time frame..invald timeframe"); 


  3. #3
    Member
    Join Date
    Oct 2006
    Posts
    35

    Great looking code!

    Thanks Whispers!

    I'll insert this code and tweak it if needed. I'll let you know how it works out. Very, very impressive - thank you so much!
    Last edited by TREQQER; 08-13-2009 at 10:45 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center