This is G o o g l e's cache of http://www.flashsandy.org/forum/index.php?act=Print&client=printer&f=17&t=149 as retrieved on 31 Jul 2007 21:42:24 GMT.
G o o g l e's cache is the snapshot that we took of the page as we crawled the web.
The page may have changed since that time. Click here for the current page without highlighting.
This cached page may reference images which are no longer available. Click here for the cached text only.
To link to or bookmark this page, use the following url: http://www.google.com/search?q=cache:eTgqLGv7aEAJ:www.flashsandy.org/forum/index.php%3Fact%3DPrint%26client%3Dprinter%26f%3D17%26t%3D149+act%3DPrint+%22index+php%22+-lofiversion+site:www.flashsandy.org&hl=en&ct=clnk&cd=78


Google is neither affiliated with the authors of this page nor responsible for its content.
These terms only appear in links pointing to this page: act print index php

Printable Version of Topic

Click here to view this topic in its original format

Sandy's Forum _ AS2 1.x versions _ use MTASC complie error with tutorials files

Posted by: lavlav Oct 20 2006, 10:37 PM

I am first time to use MTASC to complie the tutorials file
but it has an error on it

QUOTE
function init( Void ):Void <<<<<< parse error Unexpected function
{ var ecran:ClipScreen = new ClipScreen( this.createEmptyMovieClip('ecran', 1), 300, 300 );
var cam:Camera3D = new Camera3D( 700, ecran);
World3D.getInstance().addCamera( cam );
var bg:Group = new Group();
createScene( bg );
World3D.getInstance().setRootGroup( bg );
World3D.getInstance().render();
}
.
.
.


and I try to add this
QUOTE

class init
{

function init( Void ):Void <<<<<< no error now
{ var ecran:ClipScreen = new ClipScreen( this.createEmptyMovieClip('ecran', 1), 300, 300 );
var cam:Camera3D = new Camera3D( 700, ecran);
World3D.getInstance().addCamera( cam );
var bg:Group = new Group();
createScene( bg );
World3D.getInstance().setRootGroup( bg );
World3D.getInstance().render();
}
}
.
.
.
then at the end of file will come out another error on
.
.
.
init(); <<<<parse error Unexpected init


I ask is how to correct it ?

I test the tutorials files "create a first box" and "skin the box" in flash8 is no problem
I don't know how to do it......

can anyone help me ?
THX

PS. I am a very newbie to learn flash programming , and sorry for my poor english

Posted by: kiroukou Oct 20 2006, 11:08 PM

Hi,
no pb for your english wink.gif

Well you are trying to mix two different approach here.
MTASC needs a static main function to start an application.
Here you should write :

(rename your class InitTest for example)

CODE

class InitTest
{
public InitTest()
{
//constructor
init();
}

function init()
{
put the tutorial code here
}

public static function main()
{
var e:InitTest = new InitTest();
}

}

In fact with MTASC, your code MUST be completely object oriented and class based.

In the tutorial I'm using a procedural approach in Flash IDE, which allows that.
You need to port this code into a class to be able to test in with MTASC once again smile.gif

++

Posted by: lavlav Oct 23 2006, 07:47 PM

very thanks for your helpful and teaching
I am so clumsy in programming

10 years ago, I was learn C ,but later I give up
because programm is very hard for me to learn

I following your code and do ,like this ,but also come an error

CODE
class InitTest
{
public InitTest()      <<<<<< parse error Unexpected InitTest
{
//constructor
init();
}

function init()
{
    // screen creation, the object where objects will be displayed.
    var screen:ClipScreen = new ClipScreen( this.createEmptyMovieClip('screen', 1), 600, 600 );
    // we create our camera
    var cam:Camera3D = new Camera3D( 700, screen);
    // we move the camera backward to be able to see the object placed at 0,0,0
    cam.setPosition(0, 0, -500);
    // we add the camera to the world
    World3D.getInstance().addCamera( cam );
    // we create the root node.
    var bg:Group = new Group();
    // and set it as the root node of the world.
    World3D.getInstance().setRootGroup( bg );
    // and we lauch the scene creation
    createScene( bg );
    // and now that everything is created, we can launch the world rendering.
    World3D.getInstance().render();
}


function createScene( bg:Group )
{
    // We create our object. It is a cube of 50 pixels
    var o:Object3D = new Box( 50, 50, 50 );
    // Now we simply link the Object leaf to the root node, and finish the tree creation
    bg.addChild( o);
}

// We lauch the animation creation.
init();

public static function main()
{
var e:InitTest = InitTest();
}

}


I am try to search the web and also get no idea
I think I will need more more time to learn and make an exercise
thanks again

Posted by: kiroukou Oct 23 2006, 08:12 PM

Hi, no pbs wink.gif

You need to remove this part :

// We lauch the animation creation.
init();


Why? Because yu allready call init function in the constructor. And you must put the function calls (and all your programming stuff) INSIDE method declaration wink.gif


++

Posted by: lavlav Oct 23 2006, 09:07 PM

sure , I am try a few days ,like del

// We lauch the animation creation.
init();

but also get in 3rd line
public InitTest() <<<<<< parse error Unexpected InitTest

and try to del the "Void" and "bg:Group"
something like that

I may temporary stop to try this ,and go back to learn action scripts

thx , very fast reply

Posted by: SamsamTS Nov 3 2006, 03:04 PM

Ahum...
I just was going around on this forum.

About your problem, since InitTest is a function you have to declare it as a function. Is it clear ? No ? Okay here is what i mean :
Replace public InitTest by public function InitTest

Bye smile.gif

Posted by: lavlav Nov 4 2006, 08:13 PM

thx , SamsamTS

I try to change the code

but also same error....

Posted by: kiroukou Nov 5 2006, 05:31 PM

lavlav try to read some tutorials explaining how to create some AS2 classes.

and if you still need some help, please attach you code here.

++

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)