• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Duda con las clases

New Here ,
Feb 15, 2009 Feb 15, 2009

Copy link to clipboard

Copied

Hola a todos

Estoy intentando crear por primera vez una clase en Flash CS4 pero no consigo que funcione.

En el fichero .as escribo el siguiente código:

package classes {
public class ScopeTest {
public static var foo:String="bar";
public var answer:Number=42;
}
}

Luego en un fichero .fla, escribo el siguiente código en el primer fotograma:

var myTest:ScopeTest = new ScopeTest();
trace(myTest.answer)

El resultado al compilar es:

1046: No se encontró el tipo o no es una constante en tiempo de compilación: ScopeTest.

Los dos ficheros (.as y .fla) están en el mismo directorio.

Gracias por anticipado.
TOPICS
ActionScript

Views

282

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 15, 2009 Feb 15, 2009

Copy link to clipboard

Copied

LATEST
"import classes.ScopeTest":

import classes.ScopeTest;
var myTest: ScopeTest = new ScopeTest ();
trace (myTest.answer);


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines