onClipEvent(enterFrame){
_root.loadper = ((Math.floor(_root.getBytesLoaded()/ getBytesTotal()*100))+1);
this.gotoAndStop(_root.loadper);
_root.loadtxt.text = _root.loadper;
}
if (playing != true)
if (playing !== true)
dirtyc101 Wrote:Not related to your question at all, but I see an error in your code that's going to cause you fits.
- Code: Select All Code
if (playing != true)
Should instead say
- Code: Select All Code
if (playing !== true)
A single = sets the value, so in this case you're setting the variable playing to not equal true (I guess it would set it to false then?)
A double == is a query, asking if the values are equal.
Hope I helped.
-DirtyC101
EDIT: Just occurred to me I'm assuming you are using AS2. What I said is probably true in AS3 as well, but honestly don't know.
== is A and B equal?
!= Is A and Be not equal?
<= is A equal or less than B?
>= is A greater or equal to B?
we also have
< a is less than B
> A is more than B
Can't think of any others.
if(!playing){
Gorepete Wrote:In AS2 it would just be:
- Code: Select All Code
if(!playing){
You just need to put the ! in front of the statement to check for false, or leave it out for true -> if(playing)
The == true/false isn't necissary unless you are looking for a specific value -> if(playing==1);
For booleans you can just use the variable with or without !
hat973 Wrote:Im trying to make custom name thing so people can name the main character dose anyone know a code for that
BlueLight Wrote:hat973 Wrote:Im trying to make custom name thing so people can name the main character dose anyone know a code for that
Hat i don't mean to scare you but...... You should be scared!
Doing something like this in general is fairly easy.
public class A {
//variable for the player name. This will be a string since strings are perfect for text... unless you have a password.
private String playerCharacterName = "";
//this method setter gets a String and makes that string the player's name.
public void setPlayerName(String text){
this.playerCharacterName = text;
}
//when this method get called, the player's name is returned as a string.
public String getPlayerName(){
return this.playerCharacterName;
}
Okay, for starters this is java code,
Second this should be easy for starting people to do. Maybe you'd forgo the Getter and setter and just make the variable public, but it's still something basic that you should know how to do.
Third, if you're talking about help for a GUI component then you need to be a little bit more forth coming with information. The general theory is that you add a listener to one of the components, like an actionlistener to a button; then you program the listener to take information from a TextField and send it to the "SetPlayerName(String text);" method.
BlueLight Wrote:Again this is fairly basic stuff. this is the kinda thing you learn with second or third versions of Hello world.
Not trying to be harsh or insult you. It's just that i'm worried since this is fundamental stuff
hat973 Wrote:BlueLight Wrote:Again this is fairly basic stuff. this is the kinda thing you learn with second or third versions of Hello world.
Not trying to be harsh or insult you. It's just that i'm worried since this is fundamental stuff
I only lurned a few codes like play and pause button thats it my teacher never really went over all the codes only for those on movie making
BlueLight Wrote:hat973 Wrote:BlueLight Wrote:Again this is fairly basic stuff. this is the kinda thing you learn with second or third versions of Hello world.
Not trying to be harsh or insult you. It's just that i'm worried since this is fundamental stuff
I only lurned a few codes like play and pause button thats it my teacher never really went over all the codes only for those on movie making
Okay, well the first application you should ever make is something called "Hello World" and it's stupid simple!
I think this is a video for AS3 on how to do it. http://www.adobe.com/devnet/archive/fla ... class.html
and this seems to be a AS2 tutorial http://www.nidoweb.com/as2.php
You should really pick up a book on AS2 or AS3. I'd go with AS3 since it's closer to normal 'C' Programming but that's up to you.
Terrantor!!! Wrote:I got a question.
Why is there a pause before movement in this clip? For example it seems the entire movie clip plays before her x-coordinate begins to change.Spoiler (click to show/hide):
function MyPlayerMovment():void{
//Ship Animation and movment
if (MoveType=="FlyStage"){//Movie algoritms
if ((StarShipFirstStagemoveLeft==0)&&(StarShipFirstStagemoveRight==1)){
PlayerPositionToPlay=1;
if ((Player1.x<StarShipFirstStageRightLimit)&&(StarShipFirstStagemoveUp==1)){Player1.x+=StarShipFirstStageSpeed;}
}
if ((StarShipFirstStagemoveLeft==1)&&(StarShipFirstStagemoveRight==0)){
PlayerPositionToPlay=2;
if ((Player1.x>StarShipFirstStageLeftLimit)&&(StarShipFirstStagemoveUp==1)){Player1.x-=StarShipFirstStageSpeed;}
}
Player1.gotoAndStop(PlayerPositionToPlay);
}// если FlyStage
}
// Принажатии на клавиши что делать
//What to do if key is pressed
function myPlayerMovier(e:KeyboardEvent):void{
if (MoveType=="FlyStage"){
switch (e.keyCode) {
case myKeyKodeLeft :
StarShipFirstStagemoveLeft=1;
break;
case myKeyKodeUp :
if ((StarShipFirstStagemoveUp==0)&&((root as MovieClip).CHF>0)){
StarShipFirstStagemoveUp=1;
vel=13;
Player1.Player1.gotoAndPlay(2);
}
break;
case myKeyKodeRight :
StarShipFirstStagemoveRight=1;
break;
case myKeyKodeFire :
if ((StarShipFirstStagemoveUp==0)&&((root as MovieClip).CHF>0)){
StarShipFirstStagemoveUp=1;
vel=13;
Player1.Player1.gotoAndPlay(2);
}
break;
}
}//if CRun
}
//При отпускании клавиши что происходит
//what to do when key is released
function myPlayerUnMovier(e:KeyboardEvent):void{
if (MoveType=="FlyStage"){
switch (e.keyCode) {
case myKeyKodeLeft :
StarShipFirstStagemoveLeft=0;
break;
case myKeyKodeRight :
StarShipFirstStagemoveRight=0;
break;
}
}//if CRun
}
onClipEvent(enterFrame) {
if(_root.movement or _root.movementright) {
if(Key.isDown(Key.RIGHT)) {
_x += _root.movespeed;
right = true;
gotoAndStop(2);
} else if(right)
gotoAndStop(1);
}
if (_root.movement or _root.movementleft) {
if(Key.isDown(Key.LEFT)) {
_x -= _root.movespeed;
right = false;
gotoAndStop(4);
} else if(!right)
gotoAndStop(3);
}
}
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPress);
function keyPress(e:KeyboardEvent):void{
switch(e.keyCode){
case 37: character.x -= 10; break;
case 39: character.x += 10; break;
}
}
var keyArray:Array = new Array(37,39,false,false);
stage.addEventListener(Event.ENTER_FRAME, frameLoop);
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPress);
stage.addEventListener(KeyboardEvent.KEY_UP, keyRelease);
function frameLoop(e:Event):void{
checkMovement();
}
function keyPress(e:KeyboardEvent):void{
switch(e.keyCode){
case keyArray[0]: keyArray[2] = true; break;
case keyArray[1]: keyArray[3] = true; break;
}
}
function keyRelease(e:KeyboardEvent):void{
switch(e.keyCode){
case keyArray[0]: keyArray[2] = false; break;
case keyArray[1]: keyArray[3] = false; break;
}
}
function checkMovement():void{
if(keyArray[2]){
character.x -= 10;
}
if(keyArray[3]){
character.x += 10;
}
}
Terrantor!!! Wrote:Thanks for trying, i went back to AS2, though, it just works better, that way.
Users browsing this forum: No registered users