A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: OnRelease problem! easy one i guess CS4

  1. #1
    Junior Member
    Join Date
    Mar 2010
    Posts
    11

    OnRelease problem! easy one i guess CS4

    Hi guys. I really hope that you will be able to help me out on this one! it been a pain in the *** to find a solution.

    I got this movieclip. With actionscript i attached a new movieclip to this one, as a popup menu, which will show on rollover. Inside this movieclip, it automatically makes textfields, as menu options (information i recieve from a XML document)
    The problem is, that i cannot get it to respond on a onRelease function on those text fields, and i do not know why.

    Heres the code for the textfields


    Actionscript Code:
    marray = explode(",",mn);
                        var sizes = 0;
                       
                for(var i=0;i<=marray.length - 1;i++){
                    trace(i);
                   
                        mc.menu1.createTextField("txt"+i, i+59, 0, sizes, 100, 25);
                        mc.menu1["txt"+i].onRelease = function() {
                        getURL("http://pos.dk", "_blank");
                        };
                        mc.menu1["txt"+i].text = marray[i];  

                        sizes = Number(sizes) + 25;


                }


    As you see, i tried to make a onRelease on one of the links, but it just wont work probably, whats the fix for this?

    Hope someone will be there for my rescue

    Regards
    Trekz

  2. #2
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    Textfield.onRelease? that doesn't exist. onRelease works for buttons and/or Movieclips.

    gparis

  3. #3
    Junior Member
    Join Date
    Mar 2010
    Posts
    11
    Allright thanks. So may i ask what you would suggest me to do?

    Regards
    Jonas

  4. #4
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    duplicate/create movieclips in each of which you create a texfield. Put the onRelease on those movieclips.

    gparis

  5. #5
    Junior Member
    Join Date
    Mar 2010
    Posts
    11
    Can you post any kind of example please? Really appreciate your help

  6. #6
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    Just use exactly the same routine, but instead of creating "txt"+i, create "mc"+i. Then inside each mc create one textfield. Then you can say:
    mc.menu1["mc"+i].onRelease
    and
    mc.menu1["mc"+i].txt.text = marray[i];

    Here's the doc for createEmptyMovieClip. The example contains exactly what you need (creation of a mc with a textfield inside)

    gparis

  7. #7
    Junior Member
    Join Date
    Mar 2010
    Posts
    11
    Thank you! I did this, and the part where it makes the mc works just perfect! the problem is there still though, i tried every combination. this.onRollOver=function() { }
    container.onRollOver=function() { } and everything else, it just wont register the rollover.

  8. #8
    Junior Member
    Join Date
    Mar 2010
    Posts
    11
    Got it to work finally. sorry i cant post the solution, but there was no "golden" solution for this one, i rearranged the whole code.
    thanks for the code.

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