3 Replies Latest reply on Oct 15, 2007 2:56 PM by clbeech

    Linking within a dynamically generated MC

      I've got a movie player that I'm building which has a scroll pane whose content is dynamically driven from an array in ActionScript 2. The for loop creates a movie clip using the attachMovie command. The movieclip has several text fields within it populated from various arrays. I've taken care of all that. Now here's my problem.

      The first text field has to link to the video player function to start the new video. The third text field has to link to an external website using the GetURL function I would assume since it is linking to external websites, and this will be a projector file.

      Is there anyway I can assign an onPress event to a text field or something similar in Action Script 2?
        • 1. Re: Linking within a dynamically generated MC
          clbeech Level 3
          not unless the textField is within a symbol.

          However what you could do is use 'htmlText' and concatenate the string using the <a href> tag to construct a link from the dynamically generated text in the field. In this case, you then do not need the getURL function.
          • 2. Re: Linking within a dynamically generated MC
            While each textField is not it's own symbol. The entire collection of textFields are. Here's the code:

            var nc = new NetConnection();
            nc.connect(null);
            var ns = new NetStream(nc);
            myVideo.attachVideo(ns);
            var lastVideo;

            var videoTitle = ["Exhibit Essentials e-Newsletter","Show Directory Listings","MetalForming Magazine Presents Pressroom Technology Show on the Web","Attendee Invitations","Word of Mounth","New Products Directory","Next Generation Innovation Awards"];

            var videoDescription = ["Stay in the loop. Sign up for timely show updates, reports and statistics, deadlines and tips.","Onsite and online. A must if you want to be seen.","The online new-product showcase boasts three pavilions - Presses; Automation; and Coil-Handling and Prcessing, with new pavilions being added in 2008. To exhibit free, contact mobrien@pma.org.","You receive 100 automatically, but you can have as many as you want. Personally invite your customers and prospects to the show. How many do you need?","Put the METALFORM show logo on your website, in your advertisements, your product brochures.","Attendees come to trade shows to see the latest and greatest. If you have it, then flaunt it in the METALFORM New Products Directory.","Enter your new products to be voted on during Next Generation Leaders Day."];

            var videoLink = [" http://www.metalform.com","http://www.metalform.com","http://www.metalformingmagazine.com/ show/","","http://www.metalform.com/getlogos/","",""

            var videoLinkText = ["Sign up here.","Fill out your listing here","Visit the show","Tell us.","Download web and print-ready versions here.","Submit your new products here.",""];

            var videoGetSticky = ["","Get Sticky: Sponsor the online and onsite directories","","","","","Get Sticky: Sponsor the Next Generation Leaders Day"];

            var videos = ["media/video/MFVideo1.flv","media/video/MFVideo2.flv","media/video/MFVideo3.flv","media/ video/MFVideo1.flv","media/video/MFVideo2.flv","media/video/MFVideo3.flv","media/video/MFV ideo1.flv"];

            for (var q = 0; q < videos.length; q=q+1) {
            var mcVideobtn = scroller.content.attachMovie("listing","listing"+q,scroller.content.getNextHighestDepth() );

            mcVideobtn._y = (mcVideobtn._height * q);
            mcVideobtn.videoTitle.text = videoTitle
            quote:

            ;
            mcVideobtn.videoDescription.text = videoDescription
            quote:

            ;
            mcVideobtn.videoLinkText.text = videoLinkText
            quote:

            ;
            mcVideobtn.videoGetSticky.text = videoGetSticky
            quote:

            ;

            mcVideobtn.videoID = q;
            mcVideobtn.onPress = function () {
            playNewVideo(videos[this.videoID]);
            }
            };

            btnPlay.onPress = function() {
            ns.pause();
            };

            function playNewVideo (videoToLoad) {
            ns.close();
            myVideo.clear();
            ns.play(videoToLoad);
            lastVideo = videoToLoad;
            }

            Here's an sample player I'm looking to build that doesn't have all the functionality:
            METALFORM Video Player
            • 3. Re: Linking within a dynamically generated MC
              clbeech Level 3
              OK, cool. I still think that the way to solve your problem is to change the textfield that your setting the link in, to an htmlText field and use the html tag. You can concat them together to get the text to link to the URL.

              Not sure I've got the right field and links here but something like this:
              1 person found this helpful