+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11

ActionScript 3 Tips

This is a discussion on ActionScript 3 Tips within the Flash English forums, part of the Flash CS3 - CS4 - CS5 category; Hi people, we all like as3 but sometimes the easiest things can give us lots of headaches. This is why ...

  1. #1
    Member Flash Addict hard_overclocker is on a distinguished road hard_overclocker's Avatar
    Join Date
    Jul 2007
    Posts
    50
    Rep Power
    6

    Post ActionScript 3 Tips

    Hi people, we all like as3 but sometimes the easiest things can give us lots of headaches. This is why I open this thread. Here, myself and hopefully others will post tips on how to avoid headbanging

    I would like to mention that I am also new to AS3 so if I say something stupid, don't hesitate to correct me.
    Last edited by hard_overclocker; 15-11-07 at 19:51.

  2. #2
    Member Flash Addict hard_overclocker is on a distinguished road hard_overclocker's Avatar
    Join Date
    Jul 2007
    Posts
    50
    Rep Power
    6

    Re: ActionScript 3 Tips

    When you have a dynamic text field inside a Movie clip that you want to use as a button and you set
    Code:
    our_mc.buttonMode = true;
    so the hand cursor apears when you hover over it, make sure you set the following atributes to the text field:
    Code:
    our_mc.mouseChildren = false;
    our_text.selectable = false;
    This will disable the mouse for the children of our_mc. You could also use
    Code:
    our_text.mouseEnabled = false;
    our_text.selectable = false;
    to disable the mouse just for the text field.

  3. #3
    Member Flash Addict hard_overclocker is on a distinguished road hard_overclocker's Avatar
    Join Date
    Jul 2007
    Posts
    50
    Rep Power
    6

    Re: ActionScript 3 Tips

    This is not realy AS3 news but, its good practice.
    When you name your variables, it is very helpfull to add a specific suffix their name in order for flash to give you code hinting (flash opens the popup list with the available commands for selected item).

    Here are some usefull suffixes:
    • myTextField_txt - for text boxes
    • myClip_mc - for movie clips
    • myButton_btn - for buttons
    • myArray_array - you got it
    • myXML_xml - for xml

    Code hinting is very useful because it helps you prevent making some errors and keeps you on track. I like it

  4. #4
    Administrator Living At The FlepStudio! Flep is on a distinguished road
    Join Date
    Jul 2007
    Posts
    5,762
    Rep Power
    11

    Re: ActionScript 3 Tips

    The importance of Event.ADDED_TO_STAGE:
    Attached Files

  5. #5
    Administrator Living At The FlepStudio! Flep is on a distinguished road
    Join Date
    Jul 2007
    Posts
    5,762
    Rep Power
    11

    Re: ActionScript 3 Tips

    Preventing cache in Flash Player

    Just add this at the end of the call:
    Code:
    '?cachebuster='+new Date().getTime();
    For example, if we want call info.xml:
    Code:
    'http://www.sitename.com/info.xml?cachebuster='+new Date().getTime();

  6. #6
    Administrator Living At The FlepStudio! Flep is on a distinguished road
    Join Date
    Jul 2007
    Posts
    5,762
    Rep Power
    11

    Re: ActionScript 3 Tips

    MouseWheel on MAC

    Gabriel Bucknall has resolved the issue:

    pixelbreaker : AS3.0 MouseWheel on Mac OS X

  7. #7
    Administrator Living At The FlepStudio! Flep is on a distinguished road
    Join Date
    Jul 2007
    Posts
    5,762
    Rep Power
    11

    Set focus to TextField

    Set focus to TextField
    Let's say we have 2 TextFields: one_txt and two_txt.

    If you want to give focus at one_txt:

    Code:
    stage.focus=one_txt;

  8. #8
    Administrator Living At The FlepStudio! Flep is on a distinguished road
    Join Date
    Jul 2007
    Posts
    5,762
    Rep Power
    11

    Remove from the cache Flv video playback

    Remove from the cache Flv video playback
    Close the connection with the previous source and returns a player not more at cache.
    Code:
    my_flv_player.getVideoPlayer(my_flv_player.activeVideoPlayerIndex).close();

  9. #9
    Administrator Living At The FlepStudio! Flep is on a distinguished road
    Join Date
    Jul 2007
    Posts
    5,762
    Rep Power
    11

    Many MovieClip to attach from library

    Many MovieClip to attach from library
    Create an Array with all your linkage Classes:
    Code:
    var classes:Array=new Array(NameLinkage1,NameLinkage2,NameLinakge3,NameLinkage4);
    Use a loop and MovieClip as datatype:

    Code:
    for(var i:int=0;i < classes.length;i++)
    {
    	var clip:MovieClip=new classes[i]();
    }

  10. #10
    Junior Member Settled In sangram is on a distinguished road
    Join Date
    May 2009
    Posts
    5
    Rep Power
    0

    Re: ActionScript 3 Tips

    Hi All,

    There is one problem I found while working with drag and drop AS 3.0 template. I have attached drag and drop objects dynamically . drag objects consists of options. Now when I drag any drag object and place it on any of the empty drop object then it works fine. But when I drag any another drag object and drop it on other drag objects which is having text field inside it then it gives me error like,

    ReferenceError: Error #1069: Property objectType not found on flash.text.TextField and there is no default value.

    Can anyone of you tell me where I am doing wrong. Please refer to the attached file for reference.

    Kind Regards,

    Sangram.
    Attached Files

+ Reply to Thread
Page 1 of 2 1 2 LastLast

Similar Threads

  1. Replies: 4
    Last Post: 16-06-11, 03:21
  2. Tips and Tricks - MovieClip.dropTarget
    By Flep in forum Tutorials
    Replies: 2
    Last Post: 04-03-09, 08:55
  3. Tips and tricks - ghost instance
    By Flep in forum Tutorials
    Replies: 0
    Last Post: 25-09-07, 16:14
  4. Tips and tricks - MovieClip.mouseChildren
    By Flep in forum Tutorials
    Replies: 0
    Last Post: 23-09-07, 10:50

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts