Flex AS3 is incompatible to standalone application?

.NET Edition of the F-IN-BOX
danielgianni
Posts: 8
Joined: Thu Nov 22, 2007 1:33 pm

Flex AS3 is incompatible to standalone application?

Postby danielgianni » Thu Nov 22, 2007 1:46 pm

I my test occured this error bellow:

Code: Select all

Error: The SystemManager preloader_initProgressHandler was called when the currentFrame was at 2 Please add this swf to bug 129782.
   at mx.managers::SystemManager/::preloader_initProgressHandler()
   at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
   at flash.events::EventDispatcher/dispatchEvent()
   at mx.preloaders::Preloader/::timerHandler()
   at flash.utils::Timer/flash.utils:Timer::_timerDispatch()
   at flash.utils::Timer/flash.utils:Timer::tick()


My AS3 code is:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init();" usePreloader="false">

<mx:Script>
<![CDATA[
import flash.external.ExternalInterface;

private function onSend(evento:Event):void
{
   ExternalInterface.call("enviaMensagem","FLEX 2 enviando string");   
}

private function init():void
{
   ExternalInterface.addCallback("envioRetorno",envioRetorno);
}

private function envioRetorno(mensagem:String):void
{
   this.resposta_box.text = mensagem;
}

]]>

</mx:Script>   

   <mx:Button x="10" y="150" label="Enviar mensagem" width="250" id="bt_enviar" click="onSend(event)" />
   <mx:TextArea x="10" y="10" width="373" height="132" id="resposta_box" />

</mx:Application>


and my C# 2005 code is:

Code: Select all

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsApplication1
{

    public partial class Form1 : Form
    {
        private f_in_box__lib.f_in_box__control f_in_box__control1;
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            f_in_box__control1.PutMovieFromStream(this.GetType().Assembly.GetManifestResourceStream("WindowsApplication1.Resources.teste.swf"));
            f_in_box__control1.FlashMethod_Play();
        }


        private void f_in_box__control1_KeyUp(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
                case Keys.Escape:
                        Application.Exit();
                        break;
            }
        }

        private void ButtonCallActionScriptFunction_Click(object sender, EventArgs e)
        {
            String Response = f_in_box__control1.FlashMethod_CallFunction("<invoke name=\"envioRetorno\"><arguments><string>Enviando do .NET para o FLEX 2</string></arguments></invoke>");
            System.Windows.Forms.MessageBox.Show("Tipo de retorno: '" + Response + "'");
           
        }

        private void f_in_box__control1_OnFlashCall(object sender, string request)
        {
            MessageBox.Show(request);
        }


    }
}


What's this error??? I'm confusing!

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Postby Softanics » Thu Nov 22, 2007 5:57 pm

Thank you for your report.

Is it possible to reproduce this error in Internet Explorer by creating a special html page with javascript? What do you think about that?

Or send me your SWF to support (at) f-in-box.com and I will try to reproduce the error.

It's just to understand, is this problem of the f-in-box container or any container.
Best regards, Artem A. Razin,
F-IN-BOX support
Ask your question here: http://www.f-in-box.com/support.html

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Postby Softanics » Fri Nov 23, 2007 9:11 pm

Thank you, I've recieved the files.
Best regards, Artem A. Razin,

F-IN-BOX support

Ask your question here: http://www.f-in-box.com/support.html

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Postby Softanics » Mon Nov 26, 2007 10:57 am

I've created the following html file to test, and CallFunction throws exception:

Code: Select all

<object id="movie1" name="movie1" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="400" height="400">
<param name="movie" value="teste-debug.swf" />
</object>

<script>

function test()
{
   try
   {
      document.getElementById("movie1").CallFunction("<invoke name=\"envioRetorno\"><arguments><string>1</string></arguments></invoke>");
   }
   catch (e)
   {
      alert(e.toString());
   }
}

</script>

<a href = "#" onclick = "test()">TEST</a>

Best regards, Artem A. Razin,

F-IN-BOX support

Ask your question here: http://www.f-in-box.com/support.html

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Postby Softanics » Mon Nov 26, 2007 11:05 am

After googling:
http://www.google.com/search?hl=en&clie ... tnG=Search
I found:
http://tools.assembla.com/flexsdk/brows ... format=raw

From the SystemManager.as code:

Code: Select all

   public function SystemManager()
   {
      super();

      // Loaded SWFs don't get a stage right away
      // and shouldn't override the main SWF's setting anyway.
      if (stage)
      {
         stage.scaleMode = StageScaleMode.NO_SCALE;
         stage.align = StageAlign.TOP_LEFT;
      }

      // If we don't have a stage then we are not top-level,
      // unless there are no other top-level managers, in which
      // case we got loaded by a non-Flex shell or are sandboxed.
      if (SystemManagerGlobals.topLevelSystemManagers.length > 0 && !stage)
         topLevel = false;

      if (!stage)
         isStageRoot = false;

      if (topLevel)
         SystemManagerGlobals.topLevelSystemManagers.push(this);

      lastSystemManager = this;

      executeCallbacks();

      // Make sure to stop the playhead on the current frame.
      stop();

      // Add safeguard in case bug 129782 shows up again.
      if (topLevel && currentFrame != 1)
      {
         throw new Error("The SystemManager constructor was called when the currentFrame was at " + currentFrame +
                     " Please add this SWF to bug 129782.");
      }

      // Listen for the last frame (param is 0-indexed) to be executed.
      //addFrameScript(totalFrames - 1, frameEndHandler);

      root.loaderInfo.addEventListener(Event.INIT, initHandler);

   }


But not sure how can it help...
Best regards, Artem A. Razin,

F-IN-BOX support

Ask your question here: http://www.f-in-box.com/support.html

danielgianni
Posts: 8
Joined: Thu Nov 22, 2007 1:33 pm

Postby danielgianni » Mon Nov 26, 2007 12:08 pm

Softanics wrote:After googling:
http://www.google.com/search?hl=en&clie ... tnG=Search
I found:
http://tools.assembla.com/flexsdk/brows ... format=raw

From the SystemManager.as code:

Code: Select all

   public function SystemManager()
   {
      super();

      // Loaded SWFs don't get a stage right away
      // and shouldn't override the main SWF's setting anyway.
      if (stage)
      {
         stage.scaleMode = StageScaleMode.NO_SCALE;
         stage.align = StageAlign.TOP_LEFT;
      }

      // If we don't have a stage then we are not top-level,
      // unless there are no other top-level managers, in which
      // case we got loaded by a non-Flex shell or are sandboxed.
      if (SystemManagerGlobals.topLevelSystemManagers.length > 0 && !stage)
         topLevel = false;

      if (!stage)
         isStageRoot = false;

      if (topLevel)
         SystemManagerGlobals.topLevelSystemManagers.push(this);

      lastSystemManager = this;

      executeCallbacks();

      // Make sure to stop the playhead on the current frame.
      stop();

      // Add safeguard in case bug 129782 shows up again.
      if (topLevel && currentFrame != 1)
      {
         throw new Error("The SystemManager constructor was called when the currentFrame was at " + currentFrame +
                     " Please add this SWF to bug 129782.");
      }

      // Listen for the last frame (param is 0-indexed) to be executed.
      //addFrameScript(totalFrames - 1, frameEndHandler);

      root.loaderInfo.addEventListener(Event.INIT, initHandler);

   }


But not sure how can it help...





:lol: Thanks for all!!!

I solved with class library resource file and rewriting the code.


Code: Select all

namespace WindowsApplication2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

   
        }

        Objetos bb = new Objetos();

        private void Form1_Load(object sender, EventArgs e)
        {
                    f_in_box__control1.PutMovieFromStream(bb.GetType().Assembly.GetManifestResourceStream("Biblioteca.teste.swf"));
            f_in_box__control1.FlashMethod_Play();

        }

        private void CarregarBiblioteca(object sender, String caminho, System.IO.Stream Stream, ref bool Handled)
        {
            Stream FromStream = bb.GetType().Assembly.GetManifestResourceStream("Biblioteca.teste.swf");

            if (FromStream != null)
            {
                const int size = 64 * 1024;
                byte[] buffer = new byte[size];
                int ReadBytes;

                while ((ReadBytes = FromStream.Read(buffer, 0, size)) > 0)
                {
                    try
                    {
                        Stream.Write(buffer, 0, size);
                    }
                    catch (System.IO.IOException /* e */ )
                    {
                        // Loading is interrupted
                        break;
                    }
                }

                Stream.Close();

                Handled = true;
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            String Response = f_in_box__control1.FlashMethod_CallFunction("<invoke name="envioRetorno"><arguments><string>Enviando do .NET para o FLEX 2</string></arguments></invoke>");
            System.Windows.Forms.MessageBox.Show("Tipo de retorno: '" + Response + "'");
        }

        private void f_in_box__control1_OnFlashCall(object sender, string request)
        {
            MessageBox.Show(request);
        }

        private void f_in_box__control1_KeyUp(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
                case Keys.Escape:
                    Application.Exit();
                    break;
            }
        }
    }
}


Return to “.NET Edition”

Who is online

Users browsing this forum: No registered users and 11 guests

cron