Ultrashock Forums > Flash > ActionScript
ActionScript Tips Discussion

You are currently viewing our website as a guest which gives you limited access to forums, files and other resources.

Click here to join now for free, and start interacting with our members, download files and much more!

Click here if you are looking for our Flash files and other professional assets.
 
Post Reply | View first unread | Rate Thread Search this Thread | Thread Tools | Display Modes

#1
Bookmark and Share!
ActionScript Tips Discussion
Old 2006-11-04

 
This thread can be used for any questions you have about anything in the ActionScript Tips Thread.

postbit arrow 28 comments | 1292 views postbit arrow Reply: with Quote   
Coffee Monster
Nutrox is offline Super Moderator
seperator
Posts: 12,125
2004-04-25
Age: 32
Nutrox lives in United Kingdom
17
Nutrox's Avatar
seperator

Ultrashock Member Comments:
Codemonkey's Avatar Codemonkey Codemonkey is offline Super Moderator Codemonkey lives in Netherlands 2006-11-05 #2 Old  
Great stuff, mind if I join in some time?
Reply With Quote  
Nutrox's Avatar Nutrox Nutrox is offline Super Moderator Nutrox lives in United Kingdom 17 Creative Assets 2006-11-05 #3 Old  
Originally posted by Codemonkey
Great stuff, mind if I join in some time?
Jump in whenever you want to mate.
Reply With Quote  
senocular senocular is offline senocular lives in United States 2006-11-05 #4 Old  
Cool! Hopefully you'll have an easier time keeping up
Reply With Quote  
phlackee's Avatar phlackee phlackee is offline phlackee lives in Kosovo, Republic of 2006-11-05 #5 Old  
Nice
I saw thread closed Nutrox, so you will open it only when we got something to post or ...

Fast act in new discussion thread, keep it clean and post as much as you can.
Reply With Quote  
Nutrox's Avatar Nutrox Nutrox is offline Super Moderator Nutrox lives in United Kingdom 17 Creative Assets 2006-11-05 #6 Old  
The thread is closed so that it can only be added to and updated by us mods.

This thread can be used for any questions etc.
Reply With Quote  
Renjamin's Avatar Renjamin Renjamin is offline Renjamin lives in Canada 2006-11-06 #7 Old  
Nutrox's middle name is " ROCK ".

I love you man.
Reply With Quote  
Anik's Avatar Anik Anik is offline Super Moderator Anik lives in Argentina 27 Creative Assets 2006-11-06 #8 Old  
Nutrox's middle name is Splat lol, nice thread, very useful Nutrox and Codemonkey.
Reply With Quote  
Mike's Avatar Mike Mike is offline Moderator Mike lives in United Kingdom 2006-11-07 #9 Old  
Glad to see this one a sticky! Nice tips guys.

Just a note on No. 007 - Measuring frames per second.

To get the true FPS you need to look at the actual milliseconds passed as it won't always be what you dictate.

ActionScript Code:
  1. private function measure()
  2. {
  3. var now:Number = getTimer();
  4. var realInterval:Number = now - time;
  5. if (realInterval >= interval){
  6.                        onUpdate(Math.round(counter * (1000 / realInterval)));
  7.                         time = now;
  8.                         counter = 0;
  9.                 }
  10.                 counter++;
  11.         }
Reply With Quote  
Codemonkey's Avatar Codemonkey Codemonkey is offline Super Moderator Codemonkey lives in Netherlands 2006-11-07 #10 Old  
Ahh I see what you mean. Sharp eye you've got there
Reply With Quote  
Mijiru's Avatar Mijiru Mijiru is offline Mijiru lives in Belgium 2006-11-07 #11 Old  
020 - Tip 20

There is no Tip 20.
omg lorf!

really nice thread you guys got there
Reply With Quote  
senocular senocular is offline senocular lives in United States 2006-11-07 #12 Old  
May I suggest the possible inclusion of summary information for the posts, i.e. Flash Player Version and ActionScript version (others?)
Reply With Quote  
uxte's Avatar uxte uxte is offline Moderator uxte lives in Finland 2006-11-07 #13 Old  
Now this is an amazing thread
Reply With Quote  
Ziao55 Ziao55 is offline Ziao55 lives in Canada 2006-11-07 #14 Old  
My Error
Hi Nutrox,

Thanks for every single moment of your time and all the helps that your commitment will solve for all of us with less knowledge.
I tried this code, it isn't working, in both cases it will trace "Hello Ultrashock", what do I do wrong?
ActionScript Code:
  1. var myText = "Hello Ultrashock";
  2. trace( myText ); // output: Hello Ultrashock
  3.  
  4. myText.reverse();
  5. trace( myText ); // output: kcohsartlU olleH
  6.  
Reply With Quote  
Codemonkey's Avatar Codemonkey Codemonkey is offline Super Moderator Codemonkey lives in Netherlands 2006-11-07 #15 Old  
But with a small fix it works:

ActionScript Code:
  1. String.prototype.reverse = function() {
  2.     var a = this.split("");
  3.     a.reverse();
  4.     return a.join("");
  5. };
ActionScript Code:
  1. var myText = "Hello Ultrashock";
  2. trace(myText); // output: Hello Ultrashock
  3.  
  4. myText = myText.reverse();
  5. trace(myText);// output: kcohsartlU olleH
  6.  
Reply With Quote  
Ziao55 Ziao55 is offline Ziao55 lives in Canada 2006-11-07 #16 Old  
It is working!!!!
Thank you Sonny,
By the way, I am running in to a problem with my own project which I posted in Actionscript forum under "var myInterval = setInterval(nextSlide, 10000);" Can you look at it too, only if it is possible.
Reply With Quote  
schlagzeug schlagzeug is offline schlagzeug lives in United States 2006-11-13 #17 Old  
Thanks a lot for the tips, I've already started fwding the email to a couple friends of mine.
Reply With Quote  
Zee Zee is offline Zee lives in United States 2006-11-13 #18 Old  
Last edited by Zee : 2006-11-13 at 20:09.
Here's something I'd like to know...

How can you have a duplicate object (circle, shape, etc) appear on the stage (100% stage w & h) and has collission detection? Also, being able to determine the # of objects that appear on the stage, and have them appear randomly on the stage?

Thanks.

Edit: random on the stage - as in random positions.
Reply With Quote  
dream0r dream0r is offline dream0r lives in Austria 2006-11-22 #19 Old  
Hi Nutrox, master of AS

It's a very nice thing you do, you push us all, lets say from _level0 to _level2007 )

btw. theres a typo in tip 28:
ActionScript Code:
  1. xml.onLoad = Scope.rewrire(this, xmlLoadHandler, "Hello!", xml);
  2. //should be
  3. xml.onLoad = Scope.rewire(this, xmlLoadHandler, "Hello!", xml);

nice day, dan
Reply With Quote  
Nutrox's Avatar Nutrox Nutrox is offline Super Moderator Nutrox lives in United Kingdom 17 Creative Assets 2006-11-22 #20 Old  
Originally posted by dream0r
Hi Nutrox, master of AS

It's a very nice thing you do, you push us all, lets say from _level0 to _level2007 )

btw. theres a typo in tip 28:
ActionScript Code:
  1. xml.onLoad = Scope.rewrire(this, xmlLoadHandler, "Hello!", xml);
  2. //should be
  3. xml.onLoad = Scope.rewire(this, xmlLoadHandler, "Hello!", xml);

nice day, dan
Thanks, mate.
Reply With Quote  
kyleward kyleward is offline 2006-12-07 #21 Old  
keep up the good work guys!
Reply With Quote  
cisnky cisnky is offline Moderator cisnky lives in United Kingdom 2006-12-08 #22 Old  
I'm not allowed to swear, but that is one good list, man!
Reply With Quote  
ndc ndc is offline 2008-06-07 #23 Old  
I am needing some help on AS3.0 I have dynamically created a movieClip , in the form of a square and want to change the movies origin in the middle instead of the topLeft hand corner(Default Position). what is the line of code that I need to use in order for the origin to be in the center of the movieClip.

Thank you for your help
Reply With Quote  
Codemonkey's Avatar Codemonkey Codemonkey is offline Super Moderator Codemonkey lives in Netherlands 2008-06-08 #24 Old  
It would would be the topLeft hand coordination minus the half of the width and height.

ActionScript Code:
  1. // move center to coordinate (60,70)
  2. mc.x = 60 - (mc.width / 2);
  3. mc.y = 70 - (mc.height / 2);
This works for any actionscript version though (it's just math).
Reply With Quote  
ndc ndc is offline 2008-06-08 #25 Old  
Last edited by Codemonkey : 2008-06-08 at 08:41.
tyvm that is what I needed. I really appreciate your help. how do you add the code to your post like this. I am wondering, so when I want to add code examples, I can do so.

ActionScript Code:
  1. // just edit your own post (this one) and you'll see what I added
  2. var foo:Object = new Object();
Reply With Quote  
feras_flash feras_flash is offline feras_flash lives in Syrian Arab Republic 2008-07-22 #26 Old  
very use full scripts I'll try to understand all of them .....
thanks
Reply With Quote  
uxte's Avatar uxte uxte is offline Moderator uxte lives in Finland 2008-07-23 #27 Old  
Now that someone woke this thread, what do you guys think about starting an AS3 tips version? Nutrox, Codemonkey, anyone?
Reply With Quote  
Nutrox's Avatar Nutrox Nutrox is offline Super Moderator Nutrox lives in United Kingdom 17 Creative Assets 2008-07-23 #28 Old  
Senocular's thread over at the Kirupa site is all you need really, I don't see the point of mirroring that over here.

ActionScript 3 Tip of the Day
Reply With Quote  
Codemonkey's Avatar Codemonkey Codemonkey is offline Super Moderator Codemonkey lives in Netherlands 2008-07-23 #29 Old  
Well, truth is, most of the tips in our thread aren't that bound to a single as version. Bitflags or bitshifting for example is something beyond a specific syntax/library...

a lot of these tips are still relevant
Reply With Quote  
Thread Tools
Display Modes Rate This Thread
Rate This Thread: