A
A
Anton Peat2014-10-07 16:31:16
ActionScript
Anton Peat, 2014-10-07 16:31:16

1064 error in AS3 how to cure?

package 
{

  import flash.net.URLLoader;
  import flash.net.URLRequest;
  import flash.display.MovieClip;

  public class main extends MovieClip
  {

    var gid = '17157755';
    var mess = 'flapps.ru';

    var loader:URLLoader = new URLLoader();
    var request:URLRequest = new URLRequest('http://flapps.ru/script.php');// адрес вашего скрипта
    request.method = URLRequestMethod.POST;

    var vars:URLVariables = new URLVariables();
    vars['gid'] = gid;
    vars['mess'] = mess;

    request.data = vars;
    loader.addEventListener(Event.COMPLETE, onComplete);
    loader.load(request);

    function onComplete(event:Event):void
    {
      // выводим полученные данные в поле result_tf
      result_tf.text = loader.data;
    }
  }

}

I copied the code from one example on the Internet, and pasted it into the main.as of my project. I use Adobe Flash cs5.5.
An error pops up:
1046 on line 26 with the text "Type was not found or was not a compile-time constant: Event.".
I don't know why he doesn't want to look.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander Taratin, 2014-10-07
@Taraflex

import flash.events.*

A
Anton Peat, 2014-10-07
@id_aspin

Taraflex, ok I will note the solution later. There is another problem: Now there are a lot of errors (13) of the
Access of undefined property <variable> plan
What could cause such a reaction? The code is fine...

E
EjIlay, 2014-10-14
@EjIlay

Because the code is wrong.
public class main extends MovieClipit is better to write the class name with a capital letter.
request.method = URLRequestMethod.POST;Code should be placed in functional blocks (functions, static constructors or separate files), but not directly in the body of the class.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question