?
Solved

Displaying next record in actionscript

Posted on 2009-02-10
9
Medium Priority
?
182 Views
Last Modified: 2013-11-11
I have built a flash program using the one on this web site
http://www.15seconds.com/Issue/010605.htm as a base and I am not very knowledge on action scripting to make it do what I am looking to do. Right now to navigate there is a forward  buttons which will bring up the next record up, but I would like it to after a set time display the next record by itself. I tried the code shown here which is the best i been able to come up with. I am not sure if I am on the right track on not, any help would be appreciated.

function myfunction() {
	clearInterval(myInterval);
	CurrentRecord++;
	if (CurrentRecord == TotalRecords) {
		CurrentRecord = 0;
	}
	loadVariables("getdetails.asp?Record="+(CurrentRecord), this);
}
 
myInterval = setInterval(myfunction, 6000);

Open in new window

0
Comment
Question by:ccpl
  • 5
  • 4
9 Comments
 
LVL 11

Accepted Solution

by:
Eaddy Barnes earned 1500 total points
ID: 23605130
try it this way and let me know how it works

GE

function myfunction() {
 
        clearInterval(myInterval);
        CurrentRecord++;
        if (CurrentRecord == TotalRecords) {
                CurrentRecord = 0;
        }
        loadVariables("getdetails.asp?Record="+(CurrentRecord), this);
}
 
var myInterval:Number = setInterval(myfunction, 6000);

Open in new window

0
 

Author Comment

by:ccpl
ID: 23605302
nope no effect
0
 
LVL 11

Expert Comment

by:Eaddy Barnes
ID: 23605873
Your timing Function is working fine on its own.

the problem must be at some other point.

0
Independent Software Vendors: 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!

 

Author Comment

by:ccpl
ID: 23612419
it seem to work now if i publish it using flash version 6, but i lose some of my html i have in my program, and if i publish in version 8 i gain my html stuff but lose the timing part
0
 
LVL 11

Expert Comment

by:Eaddy Barnes
ID: 23612751
i am not sure where the problem is coming from my skill in asp is limited at best.
do you have to use asp. would you consider useing xml for you importing of data.
GE
0
 

Author Comment

by:ccpl
ID: 23615538
i know asp that why i am using it, and also i need it for the back end stuff i can create. The asp part of the flash works fine. Only problem really is that this one scirpt will not work when i publish it anything other then flash 6, and i need to publish it in flash 7 or 8
0
 
LVL 11

Expert Comment

by:Eaddy Barnes
ID: 23617390
ok i understand.

if another experts does not come up with anything to help you. the following is what i did when i needed a timer when i could not use action script very well.

1. i would create a moveClip off stage and call it timer.(timer_mc)
2. i would extend that timeline within that movie clip to reflect the length of time i needed per intervals(lets say 6 sec)
3. i would place the code i would want to be execute at the last frame of the time line
4. when i wanted the time loop to start i would just have the movie clip play(); and every time it reaches to the last frame the script would run.
5. if i needed the timer to stop i would just type TimerClip gotoAndStop(1);

its not script but it works

do you understand what i mean?

GE
0
 

Author Comment

by:ccpl
ID: 23623575
I have figured out that the script has been working, but not correctly. In flash 6 it will return 1,2,3,4,5 as it should, but in flash 7 and above it returns, 1,NAN,NAN,NAN,NAN. I have tried what u suggected with the movie clip and it still does the same thing, so maybe this is another problem?
0
 
LVL 11

Expert Comment

by:Eaddy Barnes
ID: 23624653
Yea i would say it is. because 2 timing events cant be wrong considering the first one was ok.

i would advise that you ask another question targeting the asp aspect of your program. and

 include asp as one of the zones it will show up on

Good Luck

GE
0

Featured Post

Independent Software Vendors: 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!

Question has a verified solution.

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

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
Suggested Courses
Course of the Month17 days, 3 hours left to enroll

862 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