?
Solved

Javascript Varablies in Flash

Posted on 2003-02-23
6
Medium Priority
?
210 Views
Last Modified: 2010-04-03
I have this script:

// devin's age
function ageBoy()
{
var event = new Date("December 21, 2002 10:47:00")
var now = new Date()
var seconds = (now - event) / 1000;
var minutes = seconds / 60;
var hours = minutes / 60;
var days = hours / 24;
daya = Math.round(days);
week = Math.round(daya/7);
dev_age = "Age = "+week+" Weeks Old
}

The above script has some rough edges but simply put I need to pull the variable dev_age into a flash text box.

I understand how to pull in simple HTML 1.0 but this is alittle beyond that.

Thanks in Advance
0
Comment
Question by:cladmonitor
6 Comments
 

Expert Comment

by:Samah
ID: 8006849
did u try the simple way?
define a var in a dynamic txt field then assign its value to dev_age :)
0
 

Author Comment

by:cladmonitor
ID: 8006865
Actually I just ran the script using actionscript..

as such

event = new Date(2002, 11, 21, 10, 47)
now = new Date()
sub = Math.round(now-event)
seconds = Math.round((now-event)/1000);
minutes = Math.round(seconds/60);
hours = Math.round(minutes/60);
days = Math.round(hours/24);
daya = Math.round(days);
week = Math.round(daya/7);
answer = "Age = "+week+" Wks or "+days+" Days old"


AS you can see the only real diffrence is the new date() style,

with valuses seperated by commans rather than a full date input.

Thanks anyways, BTW your answer would have ment I would have to update each day. thats so lo-tech
0
 
LVL 6

Expert Comment

by:henryww
ID: 8007810
ha ha ha ... lo-tech...

got it all done now? no more problems?

cheers
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 6

Expert Comment

by:henryww
ID: 8007843
for your reference ... u can also do it this way

function ageBoy()
{
event = new Date(2002, 11, 21, 10, 47)
now = new Date()
age = Math.round ((now-event) /1000 / 3600 / 24);
return age + " days";
}

dev_age = ageBoy();
trace(dev_age);

// different is in 1/1000 seconds,
// divided by 1000 = seconds
// divided by 3600 = hours
// divided by 24 = days
// divided by 7 = weeks ... & so on ..

cheers guys
0
 
LVL 9

Accepted Solution

by:
rexmor earned 800 total points
ID: 8022002
function putThisInFlash(whatValue){
   movieID.SetVariable("FlashTextFieldName",whatValue)
}

dont forget also "swLiveConnect="true"

like...

<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
 codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0"
ID=Get_Set_Variable WIDTH=550 HEIGHT=400>
 <PARAM NAME=movieID VALUE="getset.swf">
<PARAM NAME=quality VALUE=high>
<PARAM NAME=bgcolor VALUE=#FFFFFF>
<EMBED name="movieID" swLiveConnect="true"  src="getset.swf" quality=high bgcolor=#FFFFFF  WIDTH=550 HEIGHT=400 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED>
</OBJECT>

hope this helps

rex
0
 

Author Comment

by:cladmonitor
ID: 8067735
Ok now that is good info! Thats exactly what I was looking for, this will help in the future! THANKS!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.
Suggested Courses

571 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