Jump to content


Slider and External Variables


  • You cannot reply to this topic
3 replies to this topic

#1 Hayden

    P2L Jedi

  • Members
  • PipPipPip
  • 716 posts
  • Gender:Male
  • Location:Texas

Posted 21 December 2005 - 01:46 AM

Okay, so I have the slider working fine. it's moving with actionscript instead of a tween.

I also, somewhat, have it setup so i can specify what images and urls to use in the flash document from the HTML coding.

http://spaceghost.cc/esteelo/main.html

What i can't figure out is how to make the pics stay steady. I'm presuming the problem lies with the fact that there is two (2) frames in the movie to make the slider work, but i'm not sure how, or if it's possible, to make it stay steady.

In 1st frame of flash
//Loads Variables from html code
var my_lvl:LoadVars = new LoadVars();
my_lvl.image1 = pic1;
my_lvl.image2 = pic2;
my_lvl.image3 = pic3;
my_lvl.image4 = pic4;
my_lvl.image5 = pic5;
my_lvl.image6 = pic6;
my_lvl.image7 = pic7;
my_lvl.url_1 = uri1;
my_lvl.url_2 = uri2;
my_lvl.url_3 = uri3;
my_lvl.url_4 = uri4;
my_lvl.url_5 = uri5;
my_lvl.url_6 = uri6;
my_lvl.url_7 = uri7;
loadMovie(my_lvl.image1, "slider.image1");
loadMovie(my_lvl.image2, "slider.image2");
loadMovie(my_lvl.image3, "slider.image3");
loadMovie(my_lvl.image4, "slider.image4");
loadMovie(my_lvl.image5, "slider.image5");
loadMovie(my_lvl.image6, "slider.image6");
loadMovie(my_lvl.image7, "slider.image7");

//Slider Movement
_root.slider._x = _root.slider._x+1.5;
//when mouse moves left, navigation panel moves right
if ((_xmouse>60) && (_xmouse<100) && (_ymouse>15) && (_ymouse<135)) {
	_root.slider._x = _root.slider._x+10;
}
//when mouse moves right, navigation panel moves left
if ((_xmouse>450) && (_xmouse<490) && (_ymouse>15) && (_ymouse<135)) {
	_root.slider._x = _root.slider._x-10;
}
//when navigation panel reaches it's maximum x-value it resets itself
if (_root.slider._x>750) {
	_root.slider._x = -125;
}
if (_root.slider._x<-375) {
	_root.slider._x = 500;
}

HTML code
 <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="550" height="150">
	<param name="movie" value="myslider.swf?pic1=images/armyheart.jpg&pic2=images/che.jpg&pic3=images/dogmayablock.jpg&pic4=images/mlpit.jpg&pic5=images/podallas.jpg&pic6=images/rede.jpg">
	<param name="quality" value="high">
	<embed src="myslider.swf?pic1=images/armyheart.jpg&pic2=images/che.jpg&pic3=images/dogmayablock.jpg&pic4=images/mlpit.jpg&pic5=images/podallas.jpg&pic6=images/rede.jpg" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="550" height="150"></embed>
  </object>

I'm aware of the blank images, i'm not concerned with that. Just the ones that are flashing.

Thanks.

Edited by SpaceGhost, 21 December 2005 - 01:48 AM.


#2 funkysoul

    The Funky Stuff

  • Publishing Betazoids
  • PipPipPipPip
  • 2,307 posts
  • Gender:Male
  • Location:Zurich, Switzerland
  • Interests:Music: HIM, HIM, HIM, Cafe del Mar, Linkin Park, Fort Minor, Coldplay, Eric Jordan<br />Sports: Snowboarding, KiteSurfing, Extreme Sports<br />Computer: Flash, After Effects, Actionscript

Posted 21 December 2005 - 04:47 PM

Well first of all I'm wondering why you working on 2 frames instead of one, and second you should change your framerate from 12 to 25 to make the animation smoother.

About keeping the pictures stand still, you need to redefine the mouse._x point where the stripe should move.
let's assume:
0__35_75__100
[------¦---¦------]
^beginning__^end
____^ ^middle of the stripe
so you should say:

if mouse._x less then 35 move right, if mouse._x more then 35 move left.

I hope I could explain it well, otherwise let me know if you need more help

Funkysoul

Edited by funkysoul, 21 December 2005 - 04:48 PM.


#3 Hayden

    P2L Jedi

  • Members
  • PipPipPip
  • 716 posts
  • Gender:Male
  • Location:Texas

Posted 21 December 2005 - 06:27 PM

View Postfunkysoul, on Dec 21 2005, 09:47 PM, said:

Well first of all I'm wondering why you working on 2 frames instead of one, and second you should change your framerate from 12 to 25 to make the animation smoother.

About keeping the pictures stand still, you need to redefine the mouse._x point where the stripe should move.
let's assume:
0__35_75__100
[------¦---¦------]
^beginning__^end
____^ ^middle of the stripe
so you should say:

if mouse._x less then 35 move right, if mouse._x more then 35 move left.

I hope I could explain it well, otherwise let me know if you need more help

Funkysoul


hmmmm. wow. i'll try that when i get home. i have 2 frames though so that the scrolling with the actionscript will actually work. It seems that it will not go anywhere with only 1 frame. If there's a way that i'm missing to get it to work PLEASE TELL ME. expanding to 2 frames has been the only way i've gotten it to work.

thanks btw




UPDATE:

Thanks again for your help. Here's what i ended up doing.

I put in the 1st frame of my actions layer in the slider movie i made, so it loads it within that movie

loadMovie(_root.pic1, "image1a");
loadMovie(_root.pic2, "image2a");
loadMovie(_root.pic3, "image3a");
loadMovie(_root.pic1, "image1");
loadMovie(_root.pic2, "image2");
loadMovie(_root.pic3, "image3");
loadMovie(_root.pic4, "image4");
loadMovie(_root.pic5, "image5");
loadMovie(_root.pic6, "image6");
loadMovie(_root.pic7, "image7");
loadMovie(_root.pic5, "image5a");
loadMovie(_root.pic6, "image6a");
loadMovie(_root.pic7, "image7a");

Left this in the 1st frame of the root movie

//Slider Movement
_root.slider._x = _root.slider._x+1.5;
//when mouse moves left, navigation panel moves right
if ((_xmouse>60) && (_xmouse<100) && (_ymouse>15) && (_ymouse<135)) {
	_root.slider._x = _root.slider._x+10;
}
//when mouse moves right, navigation panel moves left
if ((_xmouse>450) && (_xmouse<490) && (_ymouse>15) && (_ymouse<135)) {
	_root.slider._x = _root.slider._x-10;
}
//when navigation panel reaches it's maximum x-value it resets itself
if (_root.slider._x>750) {
	_root.slider._x = -125;
}
if (_root.slider._x<-375) {
	_root.slider._x = 500;
}

and changed my framerate to 24fps as suggested.

:D

yeah and the default addresses are all google sites. :lol:

my plan is to have the images and url's i want in the flash in a database to dynamically write the html, so if i wanted to change a pic or address i could do it easily without recompiling my flash.

and thank you. :)

------------------------------

One other minor thing i noticed. more with my intro page. http://spaceghost.cc/esteelo/

i have the preloader setup to do it's job and it skips to the next screen frame 1 like it's supposed to, but doesn't stop on frame 1.

Preloader Actionscript in the preloader scene

loadedbytes = getBytesLoaded();
totalbytes = getBytesTotal();
loadedkbytes = Math.ceil(loadedbytes/1000);
totalkbytes = Math.ceil(totalbytes/1000);
if (loadedbytes == totalbytes) {
	gotoAndStop("main", 1);
}
frame = int(loadedbytes/(totalbytes/100));
tellTarget (_root.loader) {
	gotoAndStop(_root.frame);
}

1st Frame of the Main scene

stop();

there are 2 frames in the main scene. the actions layer has a key frame on the 1st and a normal frame on the 2nd.

Edited by SpaceGhost, 22 December 2005 - 01:02 AM.


#4 funkysoul

    The Funky Stuff

  • Publishing Betazoids
  • PipPipPipPip
  • 2,307 posts
  • Gender:Male
  • Location:Zurich, Switzerland
  • Interests:Music: HIM, HIM, HIM, Cafe del Mar, Linkin Park, Fort Minor, Coldplay, Eric Jordan<br />Sports: Snowboarding, KiteSurfing, Extreme Sports<br />Computer: Flash, After Effects, Actionscript

Posted 22 December 2005 - 09:34 AM

you can use it on one frame if you put your animation code on a separate movieclip and start with:
onClipEvent(enterFrame){
	//your code here
}

This should do the job, I think





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users