A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 22

Thread: [F8] Current selection cannot have actions applied to it

  1. #1
    Junior Member
    Join Date
    Dec 2005
    Posts
    4

    [F8] Current selection cannot have actions applied to it

    Hi,
    I am in flash 8. I am working on a simple button symbol and the actions panel is showing "Current selection cannot have actions applied to it" and the options are unavailable". I am working on something I have to finish real soon and I am stuck. Please help. Thanks
    Michael

  2. #2
    Ryan Thomson EvolveDesigns's Avatar
    Join Date
    Oct 2001
    Location
    British Columbia
    Posts
    3,338
    are you trying to apply your actions inside the button or on the button itself on the main stage? If you select the button on the mainstage and open the actions panel all should be well

    welcome to fk
    Evolve Designs Interactive Media
    the natural selection

  3. #3
    Junior Member
    Join Date
    Oct 2001
    Location
    In the Diamond Enclave at Jewel of Indra
    Posts
    13

    Code to make a simple button work in AS3 Flash CS3

    If you select the button on stage you get...
    "Current selection cannot have actions applied to it" error message"

    Here is the code to make the button work:

    myButton.addEventListener(MouseEvent.CLICK, myButtonFunction);
    function myButtonFunction(event: MouseEvent) {
    var request:URLRequest = new URLRequest("http://flashgameu.com");
    navigateToURL(request);
    }

    We can all thank Gary for this: http://flashgameu.com/ask_gary/ask_g...n_as3_way.html

    I worked on this from 8:00 PM until 2:00 AM and could not get it to work. I was ready to burn my copy of Flash CS3. Gary saved the day.

    Notes:

    Make sure you NAME button myButton or whatever. Just look for (Instance Name) your on the Properties tab and type the button name there.

    Because you can not add this script to the actual button in ActionScript 3, you need to make a new layer for actions. Just make new layer. Then on the first frame paste in the code above.

    From then on... ALL your button code can be placed in this SAME actions frame.

    If you want to add more buttons... just copy and paste the same code in the same action script location. Rename myButton to myButton1, myButton2 and so on and point them to the urls you want.

    When the button is clicked it will open the url in a new window. I have NO IDEA how to make it open the link in the same window. But, I am not staying up all night again to search for it.

    Ahhhhhhhhh life is not supposed to be THIS difficult.

  4. #4
    Developing For Dunkets mneil's Avatar
    Join Date
    Mar 2007
    Location
    Lincoln City
    Posts
    2,156
    Correct. AS3 will not allow you to add script on objects. I wish it had always been that way. It's much better but hard to get used to. Everything always should have either a linkage or instance name if you want to apply actions to it.

    You'll get used to it. It isn't that difficult, it just feels that way.

    Don't forget to support papervision, links below
    your a good candidate for it too since you've got as3
    http://code.mneilsworld.com/
    Text Effects | Bubbles | Dynamic Resize
    4 weeks , 20 papers ... thats 2 dollars .....Caassshhh!

  5. #5
    Junior Member
    Join Date
    Oct 2007
    Posts
    3
    What is the point of this? It seems like extra work, especially to those who don't know a whole lotta' AS.

  6. #6
    Developing For Dunkets mneil's Avatar
    Join Date
    Mar 2007
    Location
    Lincoln City
    Posts
    2,156
    I just noticed mchevere said that he's using flash8. If you have a button instance on stage you can put actions on it. Just make sure that you are actually clicked on the button when you open the actions panel.

    BigBear. It is actually far less work in the end. Putting actions in places other than the main timeline can make it hard for you to go back and edit the file a year or two down the road. Or, it can overcomplicate simple projects that run through a team of developers. If I'm working on a site with two other guys I don't want to hunt down the code that they wrote for the buttons on the buttons and find out what variables they changed or functions they called that may be located elsewhere. Putting all actions on the maintimeline simplifies your work in the long run.

    Also, AS3 uses listeners for almost everything. Which, means no real need for onEnterFrames or intervals or anything of the sort to run constantly in the backend. This dramatically speeds up the code that runs. But, in order to do all these listeners you have to write out a little more code than AS2'ers are used to. And, when you have a lot of code it is best to keep it all in one place to help you read it.

    It's all about usability.
    http://code.mneilsworld.com/
    Text Effects | Bubbles | Dynamic Resize
    4 weeks , 20 papers ... thats 2 dollars .....Caassshhh!

  7. #7
    Junior Member
    Join Date
    Oct 2007
    Posts
    3
    Wow ... glad someone knows what they're talking about! I guess AS3 is similar to CSS in that you have a central place for code. I have always used Flash by not really learning AS. My stuff looks good but I obviously end up using more frames than an expert coder would. I am not a big coder but it looks like I may need to educate myself a little before using Flash 9. Heck, a little headache now for less later...

    Thanks for the response mneil. Do you have any suggestions for a "learn AS3" book? I need to do some reading.

  8. #8
    Junior Member
    Join Date
    Oct 2007
    Posts
    3
    I guess it is similar to CSS in that way (centralized code). I see where this is useful. But, couldn't you do this before Flash 9; now it is mandatory? I am glad someone knows what they are talking about.

    Thanks for the post, mneil. Is there any literature you would suggest purchasing to learn AS3? I need to sit down and educate myself.

  9. #9
    Developing For Dunkets mneil's Avatar
    Join Date
    Mar 2007
    Location
    Lincoln City
    Posts
    2,156
    In the very beginning it was sometimes necessary to put code on objects because there weren't easy ways to target objects that existed in other places than the main timeline. But we're talking beginning of as1. In AS2 you could put all the code on the main timeline and target everything from there. It wasn't a strict rule, but it was a standard practice in the workplace. People tend to put code on objects not as a necessity, but as a shortcut; which in itself is lazy. Also, you can't do everything on an object.

    Lets say you initialize a variable on a button. Then you need another button inside a movie clip to get to that variable. You have to reference the button to get the variable. So you have to go to the root

    _parent.button.variable

    Just to access one variable. This takes flash a while to do. And, if you use _root instead of parent you can get there too. But then lets say this swf is loaded into another file, so _root is no longer the root of the swf but the root of the parent. So you'd have to do _root.holder.button.variable. That's a lot of planning ahead. When you start nesting to get more and more into trouble with things like initialized variables and function calls. Eventually it gets to be a big mess and flash runs slow trying to find all these things.

    This is why syntax with strict data typing on the main timeline is used. ie:

    var mn:Number = 0;

    Instead of just
    mn = 0

    Flash doesn't have to decide what it is you were thinking if you just tell it out by data typing the variable. I'm using data typing to show you how you can speed up flash by keeping things in order for the player to read. Keeping code on the main timeline not only keeps code easy to read for developers but it helps the flash player compile and decompile your code.

    In CS3/flash9, it is now mandatory that code goes on the timeline. You can no longer place any code on an object. Simple things like button events are now controlled by listeners. And AS3 is lightning quick compared to AS2.

    As far as a good book I have no recommendations. Someone the other day was talking about a good AS2 book they read and I guess one is coming out for AS3 but I don't recall the name. My favorite thing to learn has been the help files and the forums. Just get flashCS3 and go at it. Start simple, and work up to the things that you already new. Colin Moock is doing some AS3 tutorials. I know 1 in San Francisco and 1 in Northridge. I don't remember where the 3rd is. I'll be at the one in Northridge in November.
    http://code.mneilsworld.com/
    Text Effects | Bubbles | Dynamic Resize
    4 weeks , 20 papers ... thats 2 dollars .....Caassshhh!

  10. #10
    Ryan Thomson EvolveDesigns's Avatar
    Join Date
    Oct 2001
    Location
    British Columbia
    Posts
    3,338
    Quote Originally Posted by badgirl
    If you select the button on stage you get...
    "Current selection cannot have actions applied to it" error message"
    it says F8 in the heading, he's not using as3...
    Evolve Designs Interactive Media
    the natural selection

  11. #11
    Junior Member
    Join Date
    Jun 2008
    Posts
    5
    Quote Originally Posted by badgirl

    When the button is clicked it will open the url in a new window. I have NO IDEA how to make it open the link in the same window. But, I am not staying up all night again to search for it.
    The code for opening it in the SAME window is just to add up the following, written in RED italic:

    Code:
    myButton.addEventListener(MouseEvent.CLICK, myButtonFunction);
    function myButtonFunction(event: MouseEvent) {
    var request:URLRequest = new URLRequest("http://flashgameu.com");
    navigateToURL(request, "_self");
    }

  12. #12
    Junior Member
    Join Date
    Jul 2008
    Posts
    1
    Code is fine: i can navigate to url in adobe cs3 test movie.
    Thank You!
    The problem is with published html + swf file:
    I use that way:
    1) change position over button
    2) click a mouse
    And..
    SecurityError: Error #2028: Local-with-filesystem SWF file file:///C:/Documents and Settings/grzegorz/Moje dokumenty/Moje Projekty Flash/przycisk.swf cannot access Internet URL http://flashgameu.com.
    at global/flash.net::navigateToURL()
    at przycisk_fla::MainTimeline/openurl()

  13. #13
    Junior Member
    Join Date
    Oct 2001
    Location
    In the Diamond Enclave at Jewel of Indra
    Posts
    13
    Thanks very much annanina80, and all, I have reverted to actionscript 2.0 within flash MX. I suppose someday I will make friends with actionscript 3.0 but so far we are still fervent enemies. LOL

  14. #14
    Junior Member
    Join Date
    Aug 2008
    Posts
    3
    i have a question, i am trying to get a button to display an image within the same window not another website how would i go about doing that?

    i am using flash 8 pro. and already have a scrolling thumbnail bar at the bottom of my flash movie and have created another movie which i named mc_content above it with a different image and description of that image in every keyframe. i am trying to add the following code to each button in the scrolling thumbnails but get an error every time.

    "feature1.onRelease = function(){
    mc_content.gotoAndPlay(1)
    }"

    i get an error when i try to test this.

    please help i dont know what i am doing wrong as i am new to flash.

    thanks

  15. #15
    Junior Member
    Join Date
    Aug 2009
    Posts
    3
    Hey guys!

    I am getting really really frustrated now. the way flash was taught to me the first time is very different from what i find in various forums. I am trying to make a simple button on flash cs3 and once i want to add the actionscript it wont allow me saying " current selection cannot have actions applied to it" could someone kindly try and explain it to me step by step ( as if ur talking to a dummy) LOL

    thank you

  16. #16
    Senior Member
    Join Date
    Jun 2009
    Posts
    171
    If you adding the script to the button make sure that nothing else is selected (by clicking off the stage) then just single left-click the button and go to your actions panel without clicking off it.

  17. #17
    Junior Member
    Join Date
    Aug 2009
    Posts
    3

    :-((

    I did try mate, but it just wont let me...im going mental here:-((

  18. #18
    Junior Member
    Join Date
    Aug 2009
    Posts
    3
    Ok I will try and explain what I am doing and maybe someone can tell me where I am going wrong:

    1. create a new file (actionscript 2.0 or 3.0) question:does it make a difference?
    2. use the rectangular tool and create an oblong shape on the screen
    3. convvert it into a button symbol
    4. give it an instance name ( although i am not sure y im doing this)
    5. double click on it to enter symbol and here i see the up/down/over/hit frames
    6. because i didnt really want any rollover changes when i hit the button so i copy the first frame and paste it into down and hit
    7. i had been told not to have the button itself selected on the screen so i click the mouse outside the document area to not have the button selected and go to the up/down/over/hit layer and try to select the key frames and write the actionscript.
    this is were i keep getting the message....
    I tried creating another layer on top and calling in actions and try putting actions in those key frames but still get the same message.

    Id appreciate it if someone guided me
    Many thanks :-)

  19. #19
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    I strongly suggest you read the manual or help files or at least do some tutorials.

    To answer your questions:
    . create a new file (actionscript 2.0 or 3.0) question:does it make a difference?
    yes a big difference. AS 3.0 is a different language. Also:
    AS1: actions on symbols permitted
    AS2: actions on symbols still allowed but not recommended
    AS3: actions on symbols not allowed

    2. use the rectangular tool and create an oblong shape on the screen
    3. convvert it into a button symbol
    4. give it an instance name ( although i am not sure y im doing this)
    So you can target it with Actionscript.

    5. double click on it to enter symbol and here i see the up/down/over/hit frames
    6. because i didnt really want any rollover changes when i hit the button so i copy the first frame and paste it into down and hit
    You didn't really need multiple keyframes then. Only one keyframe on the up would have suffice.


    7. i had been told not to have the button itself selected on the screen so i click the mouse outside the document area to not have the button selected and go to the up/down/over/hit layer and try to select the key frames and write the actionscript.
    Never write AS inside a button.

    this is were i keep getting the message....
    I tried creating another layer on top and calling in actions and try putting actions in those key frames but still get the same message.
    Write on a frame on the same timeline where the button sits, for starters.

    gparis

  20. #20
    Registered User
    Join Date
    Aug 2011
    Posts
    2

    problem regarding CS3

    I am working in falsh cs3. i have created a small movie in a page.I have inserted a button bellow that movie. Now I want to create a function so that whenever the buton will be clicked the movie will play. But the problem I am facing that I can not put action script into that button. So please suggest how can I eneble that Button?? I also want that after playing that movie it will redirect in a different page.

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center