Javascript Varablies in Flash

Posted on 2003-02-23
Medium Priority
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
Question by:cladmonitor
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

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

Author Comment

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

Expert Comment

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

got it all done now? no more problems?

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Expert Comment

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();

// 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

Accepted Solution

rexmor earned 800 total points
ID: 8022002
function putThisInFlash(whatValue){

dont forget also "swLiveConnect="true"


<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
ID=Get_Set_Variable WIDTH=550 HEIGHT=400>
 <PARAM NAME=movieID VALUE="getset.swf">
<PARAM NAME=quality VALUE=high>
<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>

hope this helps


Author Comment

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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.

752 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