Flash Script - Scrolling Menu With A Scrolling Background
This is a dedicated thread for discussing the SitePoint article 'Flash Script - Scrolling Menu With A Scrolling Background'
SitePoint > Design Your Site > Flash and Actionscript
Posted on: Aug 4, 2003, 14:56
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
How To Smooth The Movement (scrolling Background And Scrolling Menu ) ?
hi! i'm new here and also a beginner in flash.. i need some help on how to smooth the movement in my flash project.. scrolling background with scrolling menu.. i got this script from a tutorial and i did some adjustment on it.. but somehow both the background and menu movement are not smooth as i want. its kept jerky along their movement. this is the script that i use to move both background and menu.. hope someone can help me to repair or to alter this script.. thanks! =)
//scrolling background with scrolling menu
//when mouse moves left, background and menu moves right
if ((_xmouse>-0.5) && (_xmouse<230) && (_ymouse>-0.1) && (_ymouse<450)) {
_root.back._x =_root.back._x +6 ;
_root.menu_mc._x =_root.menu_mc._x +10 ;
}
// when mouse moves right, background and menu moves left
if ((_xmouse>400) && (_xmouse<616) && (_ymouse>-0.1) && (_ymouse<450)) {
_root.back._x =_root.back._x -6 ;
_root.menu_mc._x =_root.menu_mc._x -10 ;
}
if (_root.back._x>1309.5) {
_root.back._x = -79;
}
if (_root.back._x<-697.8) {
_root.back._x =679;
}
//----------------------------------------------
if (_root.menu_mc._x>1200.5) {
_root.menu_mc._x = -99;
}
if (_root.menu_mc._x<-730) {
_root.menu_mc._x =569;
}[/size][/size][/size][/size]
A Menu With A Scrolling Background?
Hi there, I'm having problems with what may seem like a simple menu idea, so I'd be glad if anyone could help.
I'd like to have say 4 floating link buttons constantly in the same position at the bottom of the page, but when you click on the link then the background would slide along to a desired section.
I found it hard. I'm stuck, as I don't know what to do if the user is on Section 1, and wants to go to say section 3. That means that when the background slides along, you'd see section 2 momentarily.
Does anyone know what I'm talking about, or indeed how to do this in Flash? Any tutorials or advice would be appreciated, as this is gonna be a site for my Higher Art project.
Thanks!
-Jimmy
Creating A Background Scrolling Image Which Moves With Menu Buttons
I'm having a bit of a head scratcher here. I'm trying to create something similar to http://www.barneys.com where the user clicks on a menu button and the background image will scroll to the corresponding portion of the image. I'm currently opening the menu contents as layered movies above the background, but I can't make the image slide to the appropriate section, only jump right to the spot by loading the frame of the main timeline which is using a motion tween (the only way I could make it work, but not the way I want to nonetheless.) Can anyone point me to a tutorial or point out some actionscript I should use for this? I'm using MX, relatively green to actionscripting. Thanks.
Flash Interactive Scrolling Background
Anyone that could help me out on this one would be great! I am trying to make a flash movie which will have 2 scrolling backgrounds. The idea is similiar to http://www.saintsandsoldiers.com/ (click enter). I want the background image to stop when it runs out of room and I want the foreground images (the soldiers) to barely scroll so it changes their perspectives in relation to the background. Any sample code would be awesome! Thanks!!
Vertical Scrolling Menu Not Scrolling
i'm using flash mx
i inserted this code from a friend who had a horizontally scrolling menu and altered it slightly to suit my vertical menu. when i test it nothing moves.
i have this action placed in frame 3 of my movie:
center = 220.5;
reelPos = reel._y;
topStop = -360;
bottomStop = 360;
and in frame 4 i have this action:
if (_xmouse<774 & _xmouse>10) {
reelSpeed = (_ymouse-center)/10;
reelPos = Math.round (reelPos+reelSpeed);
if (reelPos<topStop) {
reelPos = topStop;
}
if (reelPos>bottomStop) {
reelPos = bottomStop;
}
reel._y = reelPos;
}
what am i missing here?
Scrolling Menu - Flash MX
Anyone know of a sample or tutorial for a vertically scrolling menu. I want it to scroll up when the mouse moves up and down when it moves down. I have the file started at:
http://www.inkcommercial.com/commerc...ojectment.html
But, of course the menu is stationary right now.
Thanks for any help!
Michelle
Scrolling Flash Menu
Hello All,
I'm new to this forum as well as using Flash. Even though I am the WebMaster for the company I work for, we don't use much Flash on our site. That is why I need some help.
I am trying to make a slide menu with images that will be clickable. To help you better understand exactly what I am taling about, MINI USA has a perfect example of what I would like to do. At this link:
http://www.miniusa.com/link/ourcars/...per_s_exterior
you should be at the page where there are images of the card on a slide menu and when you click it it becomes larger. That is exactly what I want to do and was lucky enough to find that page which I could use as an example. I tried following another turtorial I found on-line but that example was done using just boxes of text and not images. I cannot figure out how to replace those boxes with images instaed.
I apologize for this being so long and if this has been covered before, I did do a serach but couldn't find what I needed. If anyone can help out on my problem that would be great. Even more so if you can duplicate exactly what I referenced.
Thank you all for your time and help,
Jason
Using Flash Scrolling Text Box To Create Scrolling Schedule
Hi All,
For work, I'm creating a PowerPoint presentation which needs to include a really long schedule. I wanted this schedule to crawl up the screen. I thought of doing this part in Flash and inserting it into the PPT. Has anyone had luck with this sort of thing using PPT and Flash? Is there a better strategy. I have CS3 Web and Production and will be doing this portion of the project this weekend and thought I'd ask some pros. Is there another CS3 product that might be better. I am more Familiar with After Effects but haven't used it for anything quite like this before.
Thanks!
A Scrolling Flash Menu With Javascript - Possible?
I have created a flash menu which I would like to scroll down the page when the user scrolls down. I have created a scrolling menu before using Java script however this was not a Flash menu just an HTML so how would I use the two together?
Heres an eg of a scrolling menu, this one isnt in Flash, I just want to show you what I mean -
Scrolling Menu
Any suggestions?
Ta,
Button Menu Scrolling Bar CS2 Flash
Am brand new to flash action scripting. Have spent 2 days trying to copy, redo and understand the code for making a simple scroll menu work at the bottom of my page which is 1024 pixls wide. the movieclip containing the buttons is around 2048 pxls wide and I need the mouse over action from the enduser to make the scroll bar follow from left to right.
At the moment the scrolling only goes so far and when the clip loads is scroll to the left a bit before it stops. Am not interested in continuous scrolling when the mouse is out of the movie clip area. Here is the code I have been randonly changing to visually get something closer to what I want.
Would really appreciate any help on this
Scrolling Flash Pane On Scrolling Web Page
This is a repost, but I've still not figured out a solution.
I have a Flash movie that appears on a webpage. The Flash contains scrolling content ( scrollpane, text field, whatever).
The containing webpage is tall, and therefore also has scrollbars.
My Problem: When users try to use the MouseWheel to scroll through my Flash scrolling data, the browser page scrolls as well. It's very annoying.
I would like to be able to have the MouseWheel scroll my Flash scrolling content when it's over the flash, but scroll the webpage when it's not over the Flash.
Does anybody know a way to supress wheel-based browser page-scrolling while my mouse is over a Flash movie??? Is there a way to eat/stop propagation, whatever, of the wheel event in the brwoser, either from Flash or from Javascript?
FLASH MX 2004 - Need A Bi-Directional Scrolling Menu
Does anyone know of a quality/reliable bi-directional scrolling menu that is activated by the user's cursor?
I need a horizontal menu that scrolls left or right based on the cursors position. I've tried a couple to no avail, so I was hoping someone might know of a good script. Please help! Thank you!
R.
Help With Exsisting Code For Scrolling Flash 8 Menu
First thank you to all who read and help.
Here is a sample of what the page looks like so far:
http://paragon.sortismarketing.com/
here is my code so far:
onClipEvent (load)
{
xcenter=453;
speed=1/30;
}
onClipEvent (enterFrame)
{
var distance=_root._xmouse-xcenter;
_x+=(distance*speed);
if (_x > 0) _x=-440;
if (_x < -440) _x=0;
}
My question is, those pictures are actual buttons that I would like to make larger when the user scrolls over them.
Meghan Lundy
How Could I Set This Up? :: Scrolling Html Gallery With Stationary Flash Menu
hi guys.
not sure if this is possible. but:
I'm building an image gallery in html. It's very wide, so the browser scrolls from left to right ( about 6 images per page )
extremely simple!!
now, I'd like to have flash buttons remain at the top of the screen despite the scrolling browser window.
is that possible?
thanks in advance guys!
Scrolling Background
i got the open source file off of the open source section of FK. I was wondering if anyone out there can help me. I have created the whole thing and now I keep getting an error saying that /refresh is not found.
I was wondering if any of you guys/girls out there could pick this thing apart and see what you can do. The like is below
http://people.clemson.edu/~gseth/images/index.fla
I hope some one out here can help me
Thanks!
Scrolling Background
Hi, I want to scroll my background right and left depending on where the cursor is.
If the cursor is on the right of the screen I want the background to scroll left... I´ve seen it a million times, please help.
Scrolling Background?
I roughly understand the code.. but how do i apply it??
frame 1:
if(_xmouse< 250){
speed=1;
}
if(_xmouse>=250 || _xmouse<=350){
speed=0;
}
if(_xmouse>350){
speed=-1;
}
MyClip._x+=speed;
Frame 2:
gotoAndPlay(1);
if anyone can enlighten me i'd be most thankful! heh =)
Scrolling Background
Just wanted to know how to create a continuously scrolling background in Flash 5. Thanks
Scrolling Background...or Something
hey,i need to make a new intro for my site and i want to make it so that a character does something,and he moves to the right,but the screen keeps following him say for instance,a little man who rides a skateboard,and he does a trick,keeps riding,does a trick,rides some more,does another trick,he stops,a button appears and you press it and go to the site,i just wanna know what can i do to make the screen follow him,i read some tutorial about scrolling backgrounds but it was incredibly hard and i didnt get any of the code...it just seemed strange,please help me out here guys,i could use some help
Scrolling Background
ok i am making a game on flash and i am alomost done. I went to the flash 5 tutorial about scrolling background and enemy. But i need to create a scroll for a background like the old zelda game those anybody know how i can do this. I have a huge background made of four smaller backgrounds each the size of one scene how can i make it so my character moves to one part to the next so that the backgrounds moves with him. And not just move foward
Scrolling Background
i just want a movieclip, "backg", as a background and it moves to the right and is duplicated. it's like a never ending background...the tutorials i've got are way way complicated...
please please please teach me!
Scrolling Background
i'm working on this project where i want to use a background that scrolls along when you go to another section, similar to the one on www.djshadow.com but i don't have a clue on how to get this to work, anyone know of a tutorial on this subject, or nice enough to help me with this??? ive been trying to think about a way to solve this all day, but me is not smart enough i guess
Scrolling Background?
Hello - I want to make the center portion of this graphic scroll within the chrome box right to left. can anyone tell me how this can seemlessly be done? i know somehow the outer space part needs to be a seperate symbol and used on a motion guide - but the masking is confusing me....i'm pretty new at this.
thanks
Background Scrolling
dont really know what to call it. but how do you do this:
http://www.widegroup.net/broadband/carreras/
where its like all the backgrounds are in a big picture, and when you press a button it scrolls over to it. its probably pretty easy, im just pretty new to flash. so if anyone can explain this to me that would be great
Scrolling Background
Anyone know how to do this scrolling background effect?
example here http://www.dirtyvegas.com/
Cheers
Scrolling Background
I'm creating some games (full screen, original resolution 640×480) with a background that scrolls, I want it to scroll a bit every frame. the problem is that I get a major framerate drop. How can I work around this?
I tried 3 different ways:
*actionscript:
onClipEvent(enterFrame){
_y += 5;
}
*tween
*converting tween to keyframes
any suggestions?
nb I used a mask
because I want to draw the complete level, tiles or the same background over and over is not an option =(
Greetz, rphilipp
Scrolling Background
how do you make a background that contenuously scrolls and repeats itself? for example clouds in the background.
thx
Scrolling Background Help
I was just wondering if there was a way for a object to keep continusly scrolling in one direction.
I'm making a sprite movie where Sonic is running in one place, and I want the the land under him to scroll, making it look like he's moving.
Is there any type of actionscript command? If not, can anyone tell me how to set up a motion tween or something to make it work?
Thanks in advance
Scrolling Background
I've seen this on many sites and have always liked it, but I don't know how to make that scrolling background. I am guessing it is a movie clip, but my big problem is that whenever I try to have it scroll across the screen, it is not smooth at all, unlike the ones I have seen which seem to just flow so nicely. I also don't know how to activate the scrolling with the the mouse being on either side of the screen (no clicking, just its position alone). Any hints?
Scrolling Background
how do you scroll a back picture..have 2 pictures I want to scroll as a moving background...can't figure it out?????
Scrolling Background
hi there fellow flash users
can anyone tell me where i might find a script that would allow me to scroll a large movie clip in both x and y directions - there are lots of scripts out there that do this in one direction but does anyone know how i can do it in ALL directions
i would like to be able to have a very large map and be able to use the mouse to scroll to different parts of it just by scrolling over the top of of it
any help greatly appreciated
steve
Scrolling Background Help
I have created a scrolling background that creates an appearance of stars falling using the actionscript command of goto frame... and two layers. The scrolling background works fine but I would like to set this background to work continuously while I have additional layers with additional words and animations that come after the frame with the goto command. Any suggestions?
Something About Scrolling Background... Pls Help
hey, i've made a web page with flash. and erm.......... u need to click the buttons to move around the page..... and i want it to move to a specific place....
like when i click once, it just move there.... but now i got to hold the button to move..... pls help me..... u can check out my web site.... www.jasonpang.tk
pls help me.
Scrolling Background Help.....
pls check out my web site. www.jasonpang.tk
k.... here's my problem i want the background to move to a specific place when i clicked it....... but now, i have to hold the button to move the page....
just check out my web page to see what i mean..... www.jasonpang.tk
i hope u guys understands what i mean.....
Scrolling Background Help
i've made a web site, and there's some problem, www.jasonpang.tk
the problem is, when i hit right several times, it shows a blank page...
u guys click the left and right buttons to see for urself...
Scrolling Background
Hello,
Just wondering if anyone could help me. Im trying to create a Grand theft auto style driving game where the background scrolls rather than having a map that is stagnent on the screen.
Cheers
Background Scrolling
Hey!
Im trying to make a game sort of like Mario, and I cant seem to find a scrolling background code. Right now I have my character moving and jumping, I just cant get him to move and the background to move with him.
Scrolling Background Help
FlashGame
____________________________
So I'm workin on this game, and I've gotten most everything figured out, except one bit with my background. See, I know how to get it to scroll. I've written some code that duplicates the background I've made, and then lines it up perfectly with the original. Then moves it to the left once the player has travelled a 3rd of the screen. All that is fine and good...but....there's a small white line in between the two copies that ruins the illusion. Could someone look at my code for the game, and tell me how I could fix this. I'm pretty sure I just have to fix some numbers so the duplicate moves over to the left a bit.
______________________________________
The Code:
I have a movie clip within a movie clip for the background. The one that is duplicated is called "ground." It is within a larger clip called "mainGround." MainGround isn't visually represented at all. It is simply used as my control for the smaller one (no code is on "ground").
mainGround's ActionScript:
Code:
onClipEvent (load) {
ground.duplicateMovieClip("ground2", 100);
ground2._x = ground._x+ground._width;
groundStartx = this._x;
groundSpeed=10;
}
onClipEvent (enterFrame) {
if (_root.spaceship.scrollStart==true){
this._x-=groundSpeed;
if (this._x<= (groundStartx-ground._width)){
this._x=groundStartx-groundSpeed;
}
}
}
Scrolling Background
i'm in need of a script which will allow me to scroll a background image depending on the position of the mouse, basically i have a large map which i would like people to scroll horizontally & vertically on their mouse pos....
any direction on this would be v.appreciated
[F8] Scrolling Background
I'm trying to create a background movie clip that scrolls to the position of the mouse on screen as it corresponds to the position of the mouse on the stage. The movie clip is larger than the stage.
For instance, if I moved my mouse to dead centre on the stage the centre of the movie clip would settle to the same location. If I move my mouse to the left hand side then the movie clip would also have it's left hand side resting in the same location. Make sense? I hope so, I can't think how else to phrase it.
I came up with some initial code, but as of yet cannot work out what's going wrong.
code: a = Stage.width;
b = 565;
doStuff = function () {
x = _root._xmouse;
b_mc._x = (b*x)/a;
};
setInterval(doStuff, 1);
This might be partly due to where the image is positioned within the movie clip, I don't know.
At thye moment if my mouse rests on the left hand side of the stage then the far right of the movie clip also sits to that edge. So it's not only the wrong way around but also if I move my mouse to the far end of the stage the movie clip only moves to about half the distance it should.
Any help would be much appreciated. Sorry about the long winded explanation.
JAK
Scrolling Background Help
I want it so when you press 'right arrow' the scrolling animation plays.
Why wont it work? Does the scrolling animation need to be in the background mc?
Scrolling Background Help
I want it so when you press 'right arrow' the scrolling animation plays.
Why wont it work? Does the scrolling animation need to be in the background mc?
Scrolling Background
Hi all! I want to create a Flash website which has five navigation buttons at the bottom. When the cursor is hovering over one of the buttons the background will scroll either left or right until it reaches the correct background for that button. How would I achieve this?
The effect is used on this website and I really liked how the background scrolls around depending on which navigation button the cursor is hovering over. How was this done?
Scrolling Background Help
How did they do this scrolling background? Draw it then would I F5 or F6?
Example
Character walk...animation...project two.
Keep'er simple please.
Scrolling Background
so i've got the scrolling background thing down for a side-scroller im making, but eventually i want to have the background image change from a wall to an outside scene, by changing the artwork as you walk along. i tried this but it's not working:
Code:
if (Key.isDown(Key.RIGHT)) {
if (crouching == false) {
wall._x -= 10;
walking = true;
player_mc.gotoAndStop("walk");
if (wall._x<=800) {
walliteration++;
if (walliteration == 2) {
wall.gotoAndStop("transition");
transition = true;
}
if (transition == true) {
wall.gotoAndStop("wall2");
walliteration -= 50;
}
wall._x = 1600;
}
}
walliteration is supposed to change to different frames of the background after the wall scrolls past you a few times, but it's not changing.
Scrolling Background
Hi,
Wondering if any can see the problem with the scripting below: i've found some code online for a scrolling background and added it to my own code (intend to write my own eventually as i dont like have large chucks of code in my script i didnt write - makes it a pain in the arse to alter later on...) - the coding was written in as3 but altered slightly as it was written to be used within the movie and not in a document class.
i can see what it's trying to do - update the x position of the frontPic everytime the timer fires, which in turn is set off by mouse movements. however when i test it, the frontpic loads in fine, but as soon as you move the mouse it disappears? I've clearly gone very wrong somewhere but cant see it...
(also please forgive the general mess in the code. i've deleted large parts to make it easier to find what's relevant...)
thanks
PHP Code:
package {
//imports
public class homePage extends MovieClip {
private var timer:Timer;
private var speed:Number = 0.9;//variables
public function homePage() {
init();
}
private function init():void {
backPic=new backGrass ;
addChild(backPic);
frontPic=new frontGrass ;
addChild(frontPic);
timer = new Timer(40,0);
this.addEventListener(Event.ADDED_TO_STAGE,stageActive);
}
function stageActive(evt:Event):void {
stage.scaleMode=StageScaleMode.NO_SCALE;
stage.align=StageAlign.TOP_LEFT;
stage.addEventListener(Event.RESIZE,resizeHandler);
timer.addEventListener(TimerEvent.TIMER, moved);
backPic.x=stage.stageWidth / 2;
backPic.y=stage.stageHeight;
frontPic.x=stage.stageWidth / 2;
frontPic.y=stage.stageHeight;
this.addEventListener(MouseEvent.MOUSE_MOVE,timerCalled);
}
function resizeHandler(evt:Event):void {
//function
}
private function timerCalled(event:MouseEvent):void {
timer.stop();
timer.start();
}
private function moved(event:TimerEvent):void{
frontPic.x = speed * frontPic.x + 1 - speed * stage.stageWidth - frontPic.width * mouseX / stage.stageWidth;
backPic.x = speed * backPic.x + 1 - speed * stage.stageWidth - backPic.width * mouseX / stage.stageWidth;
if (Math.abs(frontPic.x - stage.stageWidth - frontPic.width * root.mouseX / stage.stageWidth) < 1 && Math.abs(backPic.x - stage.stageWidth - backPic.width * root.mouseX / stage.stageWidth) < 1) {
frontPic.x=stage.stageWidth - frontPic.width * mouseX / stage.stageWidth;
backPic.x=stage.stageWidth - backPic.width * mouseX / stage.stageWidth;
timer.stop();
}
event.updateAfterEvent();
}
private function onClickHome(event:MouseEvent):void {
//function
private function tweenFinished():void {
//function
private function homeIntroComplete(event:Event):void {
//function
private function homeLoading(event:ProgressEvent):void {
//function
public function homeLoadComplete(event:Event):void {
//function
private function homeOutroComplete(event:Event):void {
//function
private function homeBtnClicked(event:Event):void {
//function
}
}
Scrolling Background
hey guys I'm having real trouble coding what I think should be a simple idea, basically the concept is that the site will have a background and moving the mouse to the left will scroll the background to the left and vice versa, this I have managed to do, however I would like the process to loop around. At the moment I am using a code that recognises the location of the mouse and If it is under 200 or over 600 then it moves acordingly. the code I am using is an actionscript on frame 1 as follows:
stop();
function scrollNormal()
{
if (_xmouse <= 200){
prevFrame();
}
if (_xmouse >= 600){
nextFrame();
}
if(curFrame == "home" and _xmouse <=200){
gotoAndPlay("end")
}
if(curFrame == "end" and _xmouse >=600){
gotoAndPlay("home")
}
}
on a seperate layer I have put code on the first and last frames respectively as follows:
_global.curframe = "home";
_global.curFrame = "end";
I have been playing about with this and trying to work it out for a couple of days now and I just cant get my head around it, please please please help before my head explodes.
thanks in advance
stew
|