Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
Got an actionscript problem
Old 10-08-2004, 01:24 PM Got an actionscript problem
lajkonik86's Avatar
Ultra Talker

Posts: 389
Trades: 0
Heeyz

I've been trying to fix this problem for a while but havent succeeded so far
Would appreciate some help

I've got a flash game which sends its score allong with a checksum to a php script.
For the checksum you multiply the score with 63478256 and then take the first number and multiply it with 1 then substract 1 then take the second number and multiply it with 2 then substract 1 then take the third number and multiply it with 3 and substract 1.. and so on.

In php the code looks like this:

PHP Code:
$score $holder['score'];
$score "$score";
$scorepre $score*63478256;
$scorepre "$scorepre";
for(
$c=0;$c<strlen($scorepre);$c++) {
@
$realscorecheck+=$scorepre{$c}*($c+1);
@
$realscorecheck-="1";
}
echo 
$realscorecheck "<br>"
for a score of 200 this would output 177


In actionscript i think it should look like this: (not fully working:S)

PHP Code:
_root.scoreprecheck _root.score*63478256;
    
_root.scorecheck 0;
    for (
c=0c<length(_root.scoreprecheck); c++) {
        
_root.scorecheck+=_root.scoreprecheck.substr(c,1)*(c+1);
        
_root.scorecheck-= "1";
    }
    
trace(_root.scorecheck);

When running my game in swishmax it outputs 177.
When running my game in a browser it outputs -11

Why are the results in the browser and in swishmax different.
And what am i doing wrong?


Hope sombody knows
Greetz
Thierry
__________________
Know what to Download

Please login or register to view this content. Registration is FREE
lajkonik86 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 10-13-2004, 09:12 PM
Experienced Talker

Posts: 36
Trades: 0
Don't know, but suspect it has something to do with browser reload.
Percy is offline
Reply With Quote
View Public Profile
 
Old 10-14-2004, 01:34 AM
lajkonik86's Avatar
Ultra Talker

Posts: 389
Trades: 0
Fixed it like this:


old
_root.scoreprecheck = _root.score*63478256;

new
_root.scoreprecheck = String(_root.score*63478256);
__________________
Know what to Download

Please login or register to view this content. Registration is FREE
lajkonik86 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Got an actionscript problem
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.59210 seconds with 12 queries