Under rating threshold (hideshow)
Here's the thing. These tutorials aren't correct. They give misleaded information about the code its self leading you to believe that certain things don't belong. I spent an entire day trying to figure out why the ship wouldn't go right when I pressed the right button but it just so happens that the code was wrong. It leaves important parts out as well such as the fact that you HAVE to save before you test or it won't work.
Though they do provide you with the basic script. You might have to do a little bit of fixing but the scripts work if you figure out the problem.
Under rating threshold (hideshow)
k I figured it out, the picture wasn't lined up when I converted it into a movieclip. I deleted it and converted it again and that fixed it. Still curious if you can fix it without deleting it though.....
Under rating threshold (hideshow)
"ugh. background class cannot be found even though it is in the same folder. any help?" Save the actionscript file as Background.as (if you registered the background with symbol and class Backgroud)
Under rating threshold (hideshow)
If you have errors always save. after saving you will see that if you made everything alright, it will work just fine :)
Under rating threshold (hideshow)
@Emilade , first, is the code on your "Ship Class" Coding? if not, was the "background class" coding applied to your ship?
Under rating threshold (hideshow)
PLEASE message me if you have the answer to this. There is a random ass white line in front of my ship. How do I get rid of it?
Under rating threshold (hideshow)
need badges :D
lol :)
i'm starting this tutorials :) thx a lot very useful ... not detailled but it is a good start and a push to search more on the net thx a lot :D
Under rating threshold (hideshow)
@euanstevenson
I have the exact same problem. I'm using CS5 and whenever the ship moves so does the background. All of my code is right and I can't figure it out.
Under rating threshold (hideshow)
Lol. Go to the next page and it explains it all. Pages 7 & 8 shows you two ways of doing it..
But I have to admit; I spent 30 minutes trying to figure out how to do it :P
Under rating threshold (hideshow)
I'm guessing its an AS2 thing, but I set this.x to 0, and it scrolls just fine.
package {
import flash.display.MovieClip;
import flash.events.Event;
public class Background extends MovieClip {
private var scrollSpeed;
private var scrollWidth;
public function Background() {
scrollSpeed = 1;
scrollWidth = 2110;
addEventListener(Event.ENTER_FRAME,EnterFrame);
}
function EnterFrame(e:Event):void {
this.x -= scrollSpeed;
if (this.x < -1 * scrollWidth) {
this.x = 0;
}
}
}
}
Under rating threshold (hideshow)
nvm I got it.
Original Post
--------------
I cannot get the bg to scroll (stuck on p.5) 'the class and interface could not be loaded'. Followed everything in the tutorial paying attention to CAPS LOCK and s p a c i n g , and everything is stored in the same folder. When the ship moves, ther background moves with it.
Under rating threshold (hideshow)
use this:
class Background extends MovieClip
{
function onEnterFrame()
{
_x -= 1;
if(_x < -2110)
{
_x = 0;
}
}
}
it is on the screen there, but it works better than making tiny mistakes and having the error box yell at you. And now you don't need to write or copy from up there.
Under rating threshold (hideshow)
i have this error as well Symbol=Background, layer=Layer 1, frame=1, Line 1 The class or interface 'Background' could not be loaded. i wonder if its becos my background file is jpeg.if so how do i change it to png? thanks
Under rating threshold (hideshow)
heeey all I have a cool code that definately works:
class Background extends MovieClip
{
function onEnterFrame()
{
if( Key.isDown(Key.RIGHT) ) { _x = _x - 3; } if( Key.isDown(Key.LEFT) ) { _x = _x + 1; } _x = _x - 2;
_x -= 1;
if(_x < -2110)
{
_x = 0;
}
}
}
after that just double click the background in the libary then copy the background paste it twice
then paste them left from each other so you have 3 times the background without gaps!
after that just save it and test it!
enjoy!
(if this worked please press the +)
Under rating threshold (hideshow)
I can't download the source files, is there any other way to get them? Other than that this is a great tutorial as far as I've seen.
Under rating threshold (hideshow)
Could anyone explain why using "class Background extends MovieClip { function onEnterFrame() { _x -= 7; if(_x < -2110) { _x = 2100; } } } " instead of the code provided in the tutorial actually makes it loop seamlessly? Where does that 2100 come from?
Under rating threshold (hideshow)
I am having trouble with this. My background image isn't scrolling correctly. I c/p it so it would loop seamlessly, but only the second instance resets and continues to scroll. Any ideas why the first image isn't repeating?
Under rating threshold (hideshow)
if(_x < -2110) { _x = 600; } repositions the background just off screen for a smooth looping effect instead of having it pop into being at 0 offset, but hooray these tutorials are great so far, thanks. =D
Under rating threshold (hideshow)
Currently struggling through Animate CC and ActionScript 3.0 :), but I'm getting it - slowly, but surely. I've used code snippets to get the arrow movements and scrolling background to work so far.
Under rating threshold (hideshow)
I used flash in the premodern times, without action script. Thanks for this tutorial and make me feel "in control" again (at least less ignorant)
Under rating threshold (hideshow)
Hey I have a minor problem, when I position the background so that the left edge is on the left edge of the stage, the x and y coordinates aren't 0....I can compensate for this in the code, but I find it kind of annoying, is there a way to fix this? I'm pretty sure I chose top left for the register....
Under rating threshold (hideshow)
Does anyone know how to set the y position of the background to zero plus the y position of the ship? I tried using "_y = _y + Ship._y" but it says C:\Users\mman2112\Desktop\Shoot flash\Background.as, Line 10 "The property being referenced does not have the static attribute."
PM me with the answer
Under rating threshold (hideshow)
i Don't understand i try to put the background but it says i need it to put it in an another file that has 3.0 but when i tried it made many erros...... -Help anyone..
Under rating threshold (hideshow)
By the way people, this tutorial is wrong on making infinite scrolling, both your backgrounds will eventually crawl to the same position. The way to fix it is, either drop _x to +2110 instead of zero when it reaches -2110, or remember the initial _x in onLoad and return to initial when _x < initial-2110.
Under rating threshold (hideshow)
For all with seamless scrolling problems:
"SupremeBeing: If you background isn't seemless, change step 7 too: function onEnterFrame() { _x-=1; if (_x < -2109) { _x += 4220; } }"
I try to make a custom version with scrolling on the y axis - its preatty confusing, but finally got it working thanks to the above pasted help! WOuld be nice to have a bit mor in depth information why this stuff works like this - for me it was trial and error but I actually would have liked to understand it properly!!!
Anyway: GREAT TUTORIALS - Thanks!
Under rating threshold (hideshow)
lampy i had the same problem turns out id accidentally copied the class background extends movieclip bit twice in my code once i deleted it i was fine
Under rating threshold (hideshow)
my background and ship are moving together! but when i hide the ship layer the background is there, and when the background layer is hidden the ship is there! so why do they move together!
Under rating threshold (hideshow)
@regerity:
you siad you solved the error message by making the background a .png file... how do you do that?? (bit of a noob at all this coding stuff...)