16 Forum Posts by "Raghoul"
Now I'm wondering about this:
My Player is an undefined property(variable) & I'm not sure why.
Classes.as
package
{
import flash.events.*
import flash.display.*
public class Classes extends MovieClip
{
public function Classes();
{
var Player:Person = new Person();
Player.Name = "Fred";
trace("Name: " + Player.Name);
}
}
}
Person.as
package
{
import flash.events.*
import flash.display.*
public class Person extends MovieClip
{
var Name=String;
public function Person();
}
}
Thanks I was looking for a basically explained keyword list, basic explanations are the best because you can learn & build off of it faster & easier.
This is the function I am trying to do (File: ShowStats.as)
package
{
import flash.events.*;
import flash.display.*;
public class ShowStats extends MovieClip
{
public class BaseStatsLists
{
BaseStats.push( "Name: " );
BaseStats.push( "Attack: " );
}
}
public function ShowBaseStats():void
{
for( var i:int = 0; i < 2 ; i++ )
{
trace( BaseStats[i] );
}
}
}
BaseStatsLists.as
package
{
import flash.events.*;
import flash.display.*;
public class StatList extends MovieClip
{
var BaseStats:Array = new Array();
BaseStats.push(var Name:String) var Name = Character;
BaseStats.push(var Att:int) var Att = 0;
}
}
errors in BaseStatsLists.as
Line 9, Column 18 1084: Syntax error: expecting identifier before var.
Line 9, Column 26 1084: Syntax error: expecting rightparen before colon.
Line 9, Column 34 1084: Syntax error: expecting rightbrace before rightparen.
So I think I can make a new .as file for every character in the game.. Each .as file will be a copy(template) of an array of variables containing the character's base stats. So I think it could work if I reference the characters .as file(stat template) to load their base stats into the game, but stat upgrading will be done in the .fla
I'm trying to make a turn based game, it seems like I could eventually pull it off because it's just animations(named frames)/buttons/variables
I have animation experience because that's basically all I've done, so luckily I basically am just focusing on learning programming, the more I learn the more ideas I get & the more interested I get.
I see, I only truly tried to learn the basics of actionscript today, before I just had some scripts saved to make play buttons & such so I could get by with my movies, but now I am starting to understand variables
So can I call upon these functions (.as files) using the actionscript in my .fla (game) & they will work in my exported movie?
How about when I publish it, will these .as files with functions be a working part of my .swf?
Now it's working
Classes.as
package
{
import flash.events.*;
import flash.display.*;
public class Person extends MovieClip
{
var firstName:String;
var idn:int;
public function Person()
{
}
public function personaldata():void
{
trace( "NAME: " + firstName + " / ID#:" + idn )};
}
}
Person.as
package
{
import flash.events.*;
import flash.display.*;
public class Person extends MovieClip
{
var firstName:String;
var idn:int;
public function Person()
{
}
public function personaldata():void
{
trace( "NAME: " + firstName + " / ID#:" + idn )};
}
}
So if I put all my created functions in different .as files in the same folder as my .fla.. Then when I exported my flash, would they all be part of my .swf & work properly as long as the AS in my .fla calls upon their function?
package
{
import flash.events.*
import flash.display.*
public class Classes extends MovieClip
{
public function Classes()
{
var guy:Person = new Person
guy.firstName = "Tim"
guy.idn = 2468642
printPerson(guy);
}
public function printPerson(p:Person):void
{
trace:( "NAME:" + p.firstName + " / ID#:" + p.idn )};
}
}
This is what I have now, no error messages but the trace didn't show up in my output.
At 12/16/13 03:28 PM, Loki wrote: Technically you have billions of dead brothers and sisters. Think of all the times your dad jerked off.
No
I'm trying to create a class to use as like a templae for sets of variables(players)
Here is my error message:Line 17, Column 31 1084: Syntax error: expecting rightparen before dot.
I have an .as (AS3) file "Classes" targeted to my .fla "Classes" with the code:
package
{
import flash.events.*
import flash.display.*
public class Classes extends MovieClip
{
public function Classes()
{
var guy:Person = new Person
guy.firstName = "Tim"
guy.idn = 2468642
printPerson(guy);
}
public function printPerson(p.Person);void
{
trace:( "NAME:" + p.firstName + " / ID#:" + p.idn )};
}
}
}
& here is the script for my "Person.as" file
package
{
import flash.events.*;
import flash.display.*;
public class Person extends MovieClip
{
var firstName:String;
var idn:int;
public function Person()
{
}
}
}
I've been practicing using this code off of a tutorial & I'm trying to gain all the information from it so I can learn to write my own codes, this is the only error message I can't fix on this code.. I'm not sure what it means by rightparen & dot.
I had to hit save before I tested the movie, now it works whenever I save before I test!
package
{
import flash.display.*;
public class firstproject extends MovieClip
{
var FatKids:Number = 25
var BalognaSandwiches:Number = 70
public function firstproject()
{
trace(BalognaSandwiches-FatKids);
trace(BalognaSandwiches);
var HungryJustin:Number = 1
BalognaSandwiches = BalognaSandwiches - HungryJustin
trace(BalognaSandwiches);
var SuddenHurricane:Number = 0
BalognaSandwiches = BalognaSandwiches * SuddenHurricane
FatKids = FatKids * SuddenHurricane
HungryJustin = HungryJustin * SuddenHurricane
trace(BalognaSandwiches);
trace(FatKids);
trace(HungryJustin);
}
}
}
This is a tragic tale of eating Bologna sandwiches but everybody dies :(
Yes those were the problems I encountered before, I closed the program/reopened it & tested it & it worked!
package
{
import flash.display.*;
public class firstproject extends MovieClip
{
var chickensouls:Number = 5
public function firstproject()
{
trace(chickensouls);
}
}
}
Yes*
So is this a problem with flash?
The words package, import, public, class, variable, & function came up purple instead of blue.
I'm trying to set a variable & then show it when I export/play my movie, in my output. Just trying to practice and learn AS3.
However when I play the flash, I 2 get error 1120s. If someone could explain the problem & solution it would be a great help.
Errors:
Line 12, Column 10 1120: Access of undefined property a.
Line 13, Column 10 1120: Access of undefined property b.
Code(AS3):
package
{
import flash.display.*;
public class firstproject extends MovieClip
{
var chickensouls:Number = 5
public function firstproject()
{
trace(chickensouls);
}
}
}
I figured out that the problem was that I wrote code in the first frame of the .fla & forgot to delete it.. Now here are my error messages they seem much simpler:
Line 12, Column 10 1120: Access of undefined property a.
same for property b
I've been animating in flash for a few years & have only used a few AS2 codes such as playing frames, stopping, some variables & such, basically just codes I had saved to help me get by with my movies.
I just started using Flash Pro CC today & there was no option for AS2 so I said fuck it Y.O.L.O it's time to learn how to program properly & I'll start with AS3.. I've been looking up the basic building blocks & tutorials so I tried to make some numerical variables & then show them but I got 3 error messages & nothing on my output.
Code (AS3):
package
{
import flash.display.*;
public class firstproject extends MovieClip
{
var a:Number = 40;
var b:Number = 3;
public function firstproject();
{
trace(a);
trace(b);
}
}
}
here are my error messages:
Line 3, Column 22 1086: Syntax error: expecting semicolon before mult.
Line 9, Column 1 1084: Syntax error: expecting rightbrace before end of program.
Line 9, Column 1 1084: Syntax error: expecting rightbrace before end of program.
Perhaps someone could revise it & hopefully explain it? I'm more about learning & wanting to write my own code now than getting by with the minimum.

