Well, my mind is stunned by this problem. I know this may seem like such a simple problem, and I don’t understand why I cannot understand it, but nonetheless I cannot, and I just gave up. Here's the problem:
I have a sprite container that should contain a bunch of thumbnails for the video. I can fill the container with all the videos and everything works, but obviously, if I add some videos that will exceed the size of the flash document, so I need to add the UIScrollBar (which I did) now the scroll target is set to the container, but it doesn’t allow me scroll, and if im fix it, because the container does not have a fixed height. So I am trying to set the height of this container, but second, I am trying to set the height or even the width, all of my miniatures that I have ever seen have disappeared! It is as if the size was set to 0, when I didn’t even try to set it to the specified size, just to check and nothing. Anyway, my code, if anyone can help, I would really appreciate it! Thanks in advance!
import fl.controls.UIScrollBar; var videoList:XMLList; var numVideos:Number; var current_Video:Number = 0; var video_position:Number; var video_paused:Boolean; var xmlPlaylist:String; //XML File setup var playlist_xml:XML; var myLoader:URLLoader = new URLLoader(); //Playlist setup var thumb_width:Number; var thumb_height:Number; var thumbs_x:Number; var thumbs_y:Number; var main_container:Sprite; var thumbs:Sprite; var scrollbar:UIScrollBar; //Loader Data this.loaderInfo.addEventListener(Event.COMPLETE, loaderComplete); function loaderComplete(e:Event):void { var myQueryStrings = this.loaderInfo.parameters; xmlPlaylist = myQueryStrings.pList; myLoader.load(new URLRequest(xmlPlaylist + "?uniq=" + new Date().getTime())); } myLoader.addEventListener(Event.COMPLETE, processXML); function processXML(e:Event):void { playlist_xml = new XML(e.target.data); numVideos = playlist_xml.video.length(); videoList = playlist_xml.video; thumb_width = playlist_xml.@thumb_width; thumb_height = playlist_xml.@thumb_height; thumbs_x = playlist_xml.@thumbs_x; thumbs_y = playlist_xml.@thumbs_y; current_Video = Math.round(Math.random()*(numVideos-1))+1; current_Video--; startPlayer(); } function startPlayer() { makeContainers(); callThumbs(); setVideo(current_Video); } function makeContainers():void { main_container = new Sprite(); addChild(main_container); thumbs = new Sprite(); thumbs.addEventListener(MouseEvent.CLICK, playVideo); thumbs.addEventListener(MouseEvent.MOUSE_OVER, onOver); thumbs.addEventListener(MouseEvent.MOUSE_OUT, onOut); thumbs.x = thumbs_x; thumbs.y = thumbs_y;
Here's the problem: (If I comment on this code, it displays thumbnails)
thumbs.width = thumb_width; thumbs.height = (thumb_height + 11) * 3;
thumbs.buttonMode = true; main_container.addChild(thumbs); scrollbar = new UIScrollBar(); scrollbar.x = thumbs_x + thumb_width + 2; scrollbar.y = thumbs_y; scrollbar.setSize(25, (thumb_height + 11) * 3); scrollbar.visible = true; scrollbar.scrollTarget = thumbs; main_container.addChild(scrollbar); } function callThumbs():void { for (var i:Number = 0; i (less than) numVideos; i++)
actionscript-3 flash-cs5
Lord link
source share