[thelist] Question: Specifying an img width and height in dynamic flash scroller!

Steve Leyton steve at tvgmedia.com
Sun Aug 13 09:06:58 CDT 2006


Hi,
 
I am new to the list so I apologies if this get to you incorrectly.
 
I am trying to update our flash image scroller which pulls the latest images
from our site dynamically. I need to change the image widths and heights
however from their original settings. The flash actionscript code is the
following and I've spent hours trying to figure out how to set the sizes to
width: 100 and height: 97. If anyone could help that would be great....
 
/*
 
Image Scroller
 
*/
var root_url:String;
var ready:Boolean = false;
var link:Array = new Array();
var buttons_activated:Boolean = false;
// Function to load images
function LoadImg(Ffile:String, FNumber:Number) {
 var my_mcl:MovieClipLoader = new MovieClipLoader();
 var myListener:Object = new Object();
 container_mc.createEmptyMovieClip("image_mc"+FNumber,FNumber);
 container_mc["image_mc"+FNumber]._x = (FNumber*131)-131;
 // Create a button
 container_mc["image_mc"+FNumber].attachMovie("button_id","button_btn",7);
 my_mcl.loadClip(Ffile,container_mc["image_mc"+FNumber]);
}
// When the values are loaded the rest of the script can be activated
function showValues() {
// Run through the top 10 and load the images
 var pos:Number = 0;
 LoadImg("http://.../ <http://.../imagedata/s_>
imagedata/s_"+c.screen_id0+c.screen_type0
<http://www.totalvideogames.com/tvgadmin/content/imagedata/s_> , 1);
 LoadImg("http://.../ <http://.../imagedata/s_>
imagedata/s_"+c.screen_id1+c.screen_type1
<http://www.totalvideogames.com/tvgadmin/content/imagedata/s_> , 2);
 LoadImg("http://.../imagedata/s_"+c.screen_id2+c.screen_type2
<http://.../imagedata/s_> , 3);
 LoadImg("http://.../imagedata/s_"+c.screen_id3+c.screen_type3
<http://.../imagedata/s_> , 4);
 LoadImg("http://.../imagedata/s_"+c.screen_id4+c.screen_type4
<http://.../imagedata/s_> , 5);
 LoadImg("http://.../imagedata/s_"+c.screen_id5+c.screen_type5
<http://.../imagedata/s_> , 6);
 LoadImg("http://.../imagedata/s_"+c.screen_id6+c.screen_type6
<http://.../imagedata/s_> , 7);
 LoadImg("http://.../imagedata/s_"+c.screen_id7+c.screen_type7
<http://.../imagedata/s_> , 8);
 LoadImg("http://.../imagedata/s_"+c.screen_id8+c.screen_type8
<http://.../imagedata/s_> , 9);
 LoadImg("http://.../imagedata/s_"+c.screen_id9+c.screen_type9,10
<http://.../imagedata/s_> );
 _root.link[1] = c.game_id0;
 _root.link[2] = c.game_id1;
 _root.link[3] = c.game_id2;
 _root.link[4] = c.game_id3;
 _root.link[5] = c.game_id4;
 _root.link[6] = c.game_id5;
 _root.link[7] = c.game_id6;
 _root.link[8] = c.game_id7;
 _root.link[9] = c.game_id8;
 _root.link[10] = c.game_id9;
 _root.ready = true;
}
// Load the information
var c:LoadVars = new LoadVars();
c.onLoad = showValues;
c.load(root_url+"includes/tvglounge/screens_data.php?nocache="+random(65000)
);
// Main Script
name_txt.text = "Latest screenshots in TVG.LOUNGE";
this.createEmptyMovieClip("script_mc",0);
script_mc.onEnterFrame = function() {
 if (ready) {
  // Buttons
  if (!buttons_activated) {
   total_txt.text = c.total_screens+" screenshots in LOUNGE";
   button1_btn._width = 50;
   button1_btn.onRelease = function() {
    getURL(root_url+"games/"+c.link_name0+"_Index_"+link[1]+".htm",
"_self");
   };
   button1_btn.onRollOver = function() {
    name_txt.text = c.game_name0;
   };
   button1_btn.onRollOut = function() {
    name_txt.text = "Latest screenshots in LOUNGE";
   };
   button2_btn.onRelease = function() {
    getURL(root_url+"games/"+c.link_name1+"_Index_"+link[2]+".htm",
"_self");
   };
   button2_btn.onRollOver = function() {
    name_txt.text = c.game_name1;
   };
   button2_btn.onRollOut = function() {
    name_txt.text = "Latest screenshots in LOUNGE";
   };
   button3_btn.onRelease = function() {
    getURL(root_url+"games/"+c.link_name2+"_Index_"+link[3]+".htm",
"_self");
   };
   button3_btn.onRollOver = function() {
    name_txt.text = c.game_name2;
   };
   button3_btn.onRollOut = function() {
    name_txt.text = "Latest screenshots in LOUNGE";
   };
   button4_btn.onRelease = function() {
    getURL(root_url+"games/"+c.link_name3+"_Index_"+link[4]+".htm",
"_self");
   };
   button4_btn.onRollOver = function() {
    name_txt.text = c.game_name3;
   };
   button4_btn.onRollOut = function() {
    name_txt.text = "Latest screenshots in LOUNGE";
   };
   button5_btn.onRelease = function() {
    getURL(root_url+"games/"+c.link_name4+"_Index_"+link[5]+".htm",
"_self");
   };
   button5_btn.onRollOver = function() {
    name_txt.text = c.game_name4;
   };
   button5_btn.onRollOut = function() {
    name_txt.text = "Latest screenshots in LOUNGE";
   };
   button6_btn.onRelease = function() {
    getURL(root_url+"games/"+c.link_name5+"_Index_"+link[6]+".htm",
"_self");
   };
   button6_btn.onRollOver = function() {
    name_txt.text = c.game_name5;
   };
   button6_btn.onRollOut = function() {
    name_txt.text = "Latest screenshots in LOUNGE";
   };
   button7_btn.onRelease = function() {
    getURL(root_url+"games/"+c.link_name6+"_Index_"+link[7]+".htm",
"_self");
   };
   button7_btn.onRollOver = function() {
    name_txt.text = c.game_name6;
   };
   button7_btn.onRollOut = function() {
    name_txt.text = "Latest screenshots in LOUNGE";
   };
   button8_btn.onRelease = function() {
    getURL(root_url+"games/"+c.link_name7+"_Index_"+link[8]+".htm",
"_self");
   };
   button8_btn.onRollOver = function() {
    name_txt.text = c.game_name7;
   };
   button8_btn.onRollOut = function() {
    name_txt.text = "Latest screenshots in LOUNGE";
   };
   button9_btn.onRelease = function() {
    getURL(root_url+"games/"+c.link_name8+"_Index_"+link[9]+".htm",
"_self");
   };
   button9_btn.onRollOver = function() {
    name_txt.text = c.game_name8;
   };
   button9_btn.onRollOut = function() {
    name_txt.text = "Latest screenshots in LOUNGE";
   };
   button10_btn.onRelease = function() {
    getURL(root_url+"games/"+c.link_name9+"_Index_"+link[10]+".htm",
"_self");
   };
   button10_btn.onRollOver = function() {
    name_txt.text = c.game_name9;
   };
   button10_btn.onRollOut = function() {
    name_txt.text = "Latest screenshots in LOUNGE";
   };
   buttons_activated = true;
  }
  // Scroll mini_movies
  for (n=1; n<11; n++) {
   container_mc["image_mc"+n]._x -= 4;
   _root["button"+n+"_btn"]._x = container_mc["image_mc"+n]._x;
   // If the movie has gone off of the page
   if (container_mc["image_mc"+n]._x<-130) {
    container_mc["image_mc"+n]._x = 9*131;
   }
  }
 }
};




More information about the thelist mailing list