473,395 Members | 2,443 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Please help, Shared objects problems, Enlightened individual required

Hi, I'm having trouble with setting up a shared object and I really need some help from someone more enlighten then myself in the field of actionscript :)

Basically I have a talking character that introduces a site and says hello (basically an intro) but I don’t want him to repeat his speech every single time the area gets refreshed or the page gets revisited. On top of that I don’t want the speech to get skipped once and never seen again, I just want to reset the cycle a little later on.

The whole premise has become a little complex for me and I wasn’t really sure what the best way of doing this was, although through my travels I did find some code in a tutorial that implements a time control but I'm not exactly sure how to fix it up to apply to my situation.

This is put in the first frame to control the timing:

var today = new Date();
var so:SharedObject = SharedObject.getLocal("time");
var period = 15000;

Then this is put into the instance:

if (loaded == total)
{
if (!((_root.today-_root.so.data.val)<_root.period))
{
_root.so.data.val = _root.today;
_root.so.flush();
_root.gotoAndPlay(2); //full animation
}
else
{
_root.so.data.val = _root.today;
_root.par = "skip";
_root.gotoAndStop(162);
}
}

The issue is when I add it to the instance of course I get a:

**Error** Scene=Scene 1, layer=Speech Bubble, frame=1:Line 2: Statement must appear within on/onClipEvent handler
if (loaded == total)

because it hasn't been placed in a frame. Yet the tutorial seems to have no such problem.

I'm not sure if it can be placed in every frame but there’s 165 frames and many animations so an easier way to set up the code would be much appreciated.

I did consider setting up an 'enter page' however because of the nature of the situation and the character talking on every page and not just the main page (for example: he talks again in the ‘Links' page) I was concerned I would need a mechanism I can use throughout the site to prevent the problem as I can’t build an 'enter page' for every single link.

Otherwise I might just be going the complete wrong way about it and If there’s a method out there that makes more sense I would love to do it that way instead :) if you are able to help me thank you so much!
May 9 '07 #1
1 1538
Motoma
3,237 Expert 2GB
You might be better off setting a COOKIE which expires in a set amount of time, and checking that COOKIE before deciding whether to run the speech or not.
May 9 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: abcd | last post by:
kutthaense Secretary Djetvedehald H. Rumsfeld legai predicted eventual vicmadhlary in Iraq mariyu Afghmadhlaistmadhla, kaani jetvedehly after "a ljetvedehg, hard slog," mariyu vede legai pressed...
11
by: dhnriverside | last post by:
Hi peeps Ok, so I thought I'd have a go at making a console app in VS2k5... I haven't written any windows apps for years, let alone dos apps (been web programming) and I've hit a dumb error... ...
15
by: Rob Nicholson | last post by:
A consequence of the ASP.NET architecture on IIS has just hit home with a big thud. It's to do with shared variables. Consider a module like this: Public Module Functions Public GlobalName As...
4
by: john | last post by:
I'm having some Interop problems. I really need someone's help on this, i'm running out of ideas. I have upgraded my Data access controls to the latest ver. Now then i have a form with these...
3
by: Adriano | last post by:
Hello, when I try to print something, either DataGrid or from Crystal Report viever the folowing error message appears and cancels printing: Object reference not set to an instance of an...
1
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
32
by: robert d via AccessMonster.com | last post by:
I'm looking at converting DAO to ADO in my app. All of my DAO connections are of the following structure: Dim wsName As DAO.Workspace Dim dbName As DAO.Database Dim rsName As DAO.Recordset ...
1
by: Darkman2008 | last post by:
Hello This is an extension task for my current course where I have to create a Word guessing game. There are 4 classes.(List, game, word and InputRead) The List class holds a number of...
6
by: xhe | last post by:
I am using ffmpeg to convert video, this is a sample script: $str='/home/transla1/bin/ffmpeg -i /home/transla1/public_html/ cybertube/web/uploads/video/31_AK000005.AVI -s 240x180 -b 100k -ar...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.