0
votes

in ActionScript2 there is a way to intercept the click on a movieClip?

I'll explain; I've this code:

planGroup.createEmptyMovieClip("textObject", 90);

if (textArray != "")
{
    for (tn = 0; tn < textArray.length; tn++)
    {
        textFormat = new TextFormat();
        textFormat.size = 100 * 0.35;

        var lbl = planGroup.textObject.createTextField("My_Instance_Name", tn,xt - minPlanX, yt - minPlanY,150,90);
        lbl.text = textArray[tn].attributes.text;

        xt = textArray[tn].attributes.x * multFactor;
        yt = -textArray[tn].attributes.y * multFactor;

        planGroup.textObject.createEmptyMovieClip("invis", getNextHighestDepth());
        with (planGroup.textObject.invis) {
          beginFill(0x22ffff, 50);
          moveTo(xt - minPlanX, yt - minPlanY);
          lineTo(xt - minPlanX + 150, yt - minPlanY);
          lineTo(xt - minPlanX + 150, yt - minPlanY + 90);
          lineTo(xt - minPlanX, yt - minPlanY + 90);
          lineTo(xt - minPlanX, yt - minPlanY);
          endFill();
        }
        planGroup.textObject.onRelease = function() {
          trace("click");
        }

that is I want to make the text clickable..and with this code it is, but i want the onRelease() makes different things on different text..so, how can I understand where the click come from?

Furthermore i noticed that the shape is drawn only on the last item of the 'for'.

Any ideas? Thanks in advance!

Seems like you are overwriting the same textObject on every tn value. Did you try something like textObject[tn]? - RST
hi @RST thank you for answering..I tought this method was too complicated to obtain what I want, so I used invisible buttons rather than invisible movie clip below the textField! cheers - roccocullo