Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > ActionScript Forums Group > ActionScript 3.0

Reply
 
Thread Tools Rate Thread Display Modes
Old 11-06-2007, 04:04 PM   #1
05studios
DestroyYourComputer
 
Join Date: Jan 2004
Location: San Diego, Ca
Posts: 437
Send a message via AIM to 05studios
Question 1026: Constructor functions must be instance methods.

I am getting this error for some reason.

I have a movieClip that I set to export actions on first frame...and it started after I turned that on. I created a .as file named after the class I put in the linkage panel.

I just threw this in the class because I dont want anything to happen, there, I just want to get this darn movieClip linked so I can dynamically load it in during my XML load in.

any ideas? maybe someone can point me in a good direction to getting movieClips linked and able to be brought in dynamically. I cant find anything.

ActionScript Code:
public class tourDate { public function tourDate() { public static function thetourDate (inputString):int{     } } }
05studios is offline   Reply With Quote
Old 11-06-2007, 04:10 PM   #2
senocular
six eyes
 
senocular's Avatar
 
Join Date: Jan 2003
Location: San Francisco, CA (USA)
Posts: 7,875
Send a message via ICQ to senocular Send a message via AIM to senocular Send a message via MSN to senocular Send a message via Yahoo to senocular
Default

1. you don't have a package block
2. your static method is nested in the constructor
ActionScript Code:
package {     public class tourDate{         public function tourDate(){         }         public static function thetourDate (inputString):int{         }     } }
__________________
(6)
senocular is offline   Reply With Quote
Old 11-06-2007, 04:35 PM   #3
05studios
DestroyYourComputer
 
Join Date: Jan 2004
Location: San Diego, Ca
Posts: 437
Send a message via AIM to 05studios
Default

I changed the file to match yours, and I still get this error;

1026: Constructor functions must be instance methods.
05studios is offline   Reply With Quote
Old 11-06-2007, 04:54 PM   #4
senocular
six eyes
 
senocular's Avatar
 
Join Date: Jan 2003
Location: San Francisco, CA (USA)
Posts: 7,875
Send a message via ICQ to senocular Send a message via AIM to senocular Send a message via MSN to senocular Send a message via Yahoo to senocular
Default

is this the class you're using for the movie clip too? I couldn't tell exactly from your description. If so it should extend MovieClip
__________________
(6)
senocular is offline   Reply With Quote
Old 11-06-2007, 05:07 PM   #5
05studios
DestroyYourComputer
 
Join Date: Jan 2004
Location: San Diego, Ca
Posts: 437
Send a message via AIM to 05studios
Default

I changed it to extend MovieClip and it throws the same error.

Any other ideas?

I'm just trying to use attachMovie to load movies from my linked library.

what is going wrong? do I need an external class file for every mc i want to link from the library?
05studios is offline   Reply With Quote
Old 11-06-2007, 05:13 PM   #6
dr_zeus
Feathers
 
dr_zeus's Avatar
 
Join Date: Mar 2005
Location: Silicon Valley
Posts: 1,999
Default

attachMovie() doesn't exist in AS3. You should do something like this:

ActionScript Code:
var clip:MyLibraryClip = new MyLibraryClip(); this.addChild(clip);

Where MyLibraryClip is whatever you named the symbol in your library.
__________________
Josh Tynjala | Feathers
dr_zeus is offline   Reply With Quote
Old 11-06-2007, 05:22 PM   #7
05studios
DestroyYourComputer
 
Join Date: Jan 2004
Location: San Diego, Ca
Posts: 437
Send a message via AIM to 05studios
Default

I would love to do it like that, but whenever I set up a mc to be linked in the library, it throws this error 'Constructor Functions must be instance methods'

any idea why?
05studios is offline   Reply With Quote
Old 11-06-2007, 05:29 PM   #8
05studios
DestroyYourComputer
 
Join Date: Jan 2004
Location: San Diego, Ca
Posts: 437
Send a message via AIM to 05studios
Default

what do i put for the class?
05studios is offline   Reply With Quote
Old 11-06-2007, 07:32 PM   #9
05studios
DestroyYourComputer
 
Join Date: Jan 2004
Location: San Diego, Ca
Posts: 437
Send a message via AIM to 05studios
Default

I am using the following as Tourdate.as, and that is the name of the class in my Linkage of the library for the MC i want to load with addChild. I keep getting this error. Any ideas?

ActionScript Code:
var clip:Tourdate = new Tourdate(); this.addChild(clip);

TOURDATE.AS
ActionScript Code:
package {     import flash.display.MovieClip;         public class Tourdate extends MovieClip     {         public static function Tourdate()         {                     }     } }
05studios is offline   Reply With Quote
Old 11-06-2007, 10:06 PM   #10
dr_zeus
Feathers
 
dr_zeus's Avatar
 
Join Date: Mar 2005
Location: Silicon Valley
Posts: 1,999
Default

The constructor should not be static.
__________________
Josh Tynjala | Feathers
dr_zeus is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Why doesn't Graphics class methods take class instance as params? Flash Gordon ActionScript 3.0 14 07-05-2007 11:29 PM
Playing an MC using a variable for instance name Thom Phelps Simple Stuff (Newbies) 4 07-25-2006 04:21 PM
Playing one movieclip instance AFTER another Lordy ActionScript 2.0 8 05-30-2006 05:54 PM
Database simulated with arrays on a cd-rom lecasn5 Components 61 09-07-2004 11:40 AM
inheritance - Mortimer Jazz ActionScript 1.0 (and below) 10 07-24-2003 09:51 PM


All times are GMT. The time now is 11:53 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.