Skip navigation
Roccopino
Currently Being Moderated

Caricare file swf in pagina sito flash

Mar 18, 2013 1:50 PM

Tags: #flash_professional

http://forums.adobe.com/community/flash/flash_general

 

Salve, sto provando  a creare un sito web  che fino ad adesso che sembra   perfettamente funzionante.

Ho provato poi ad inserire una galleria immagini file swf  esterno, ma riesco a vedere solo la maschera con i pulsanti mentre delle immagini assolutamente niente. Dove sbaglio?

 

Il codice  che carico è quello fornito da flash :

 

My Gallery.addEventListener(MouseEvent.CLICK, fl_ClickToLoadUnloadSWF_3);

import fl.display.ProLoader; var fl_ProLoader_3:ProLoader; 

var fl_ToLoad_3:Boolean = true;

function fl_ClickToLoadUnloadSWF_3(event:MouseEvent):void

{          if(fl_ToLoad_3)

            {

                        fl_ProLoader_3 = new ProLoader();

                        fl_ProLoader_3.load(new URLRequest("C:\Documents and Settings\Administrator\Desktop\sito\gallery_Gallery.swf"));

                        addChild(fl_ProLoader_3);

            }

            else

            {

                        fl_ProLoader_3.unload();

                        removeChild(fl_ProLoader_3);

                        fl_ProLoader_3 = null;

            }

            // Indica se volete caricare o scaricare il file SWF

            fl_ToLoad_3 = !fl_ToLoad_3;

}

 

Ringrazio

 

Ugo

 
Replies
  • Currently Being Moderated
    Mar 18, 2013 11:34 PM   in reply to Roccopino

    Now the whole thing in English, please ;-)

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 21, 2013 3:54 AM   in reply to moccamaximum

    Hi, I'm trying to create a website and so far everything works perfectly.

    I then tried to insert an image gallery swf file outside, placed on a frame of the movie, but I can see only the mask with the buttons while the images of the gallery, absolutely nothing. What's wrong?

     

    The code that load is provided by flash:

     

    gallery_Gallery.addEventListener (MouseEvent.CLICK, fl_ClickToLoadUnloadSWF_3);

    import fl.display.ProLoader; var fl_ProLoader_3: ProLoader;

    var fl_ToLoad_3: Boolean = true;

    fl_ClickToLoadUnloadSWF_3 function (event: MouseEvent): void

    {If (fl_ToLoad_3)

                 {

                             fl_ProLoader_3 = new ProLoader ();

                             fl_ProLoader_3.load (new URLRequest ("C: \ Documents and Settings \ Administrator \ Desktop \ website \ gallery_Gallery.swf"));

                             addChild (fl_ProLoader_3);

                 }

                 else

                 {

                             fl_ProLoader_3.unload ();

                             removeChild (fl_ProLoader_3);

                             fl_ProLoader_3 = null;

                 }

                 / / Indicates whether you want to load or unload the SWF

                 fl_ToLoad_3 =! fl_ToLoad_3;

    }

     

    Thanks in advance

     

    Ugo

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 21, 2013 4:10 AM   in reply to Rocco Ugo

    For starters: where do you get the gallery.swf  (you have obviously no access to the source code)?

     

    The gallery.swf might be AS1/AS2 so it won`t work at all inside an AS3 swf or L: the gallery uses realtive paths/global variables that might not work inside another swf.

     

    There are really dozens of possibilities that prevent this image gallery from working inside your own application.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 21, 2013 7:42 AM   in reply to moccamaximum

    Thanks for the reply.

    You're right, I did a test: the file is in AS2.

    Is there a way to convert it to AS3?

     

     

    thanks

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 21, 2013 7:55 AM   in reply to Rocco Ugo

    No and its not needed at all. You can find hundreds of free image galleries on the net.

    "as3 image gallery"

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 25, 2013 4:27 AM   in reply to moccamaximum

    Hello moccamaximum,

    sorry for requesting help.

    I created the image gallery, everything is working correctly, the picture number 1, the zoom works correctly except zoom images 2,3 and 4. why?

    Also, the image number1 after reduction does not disappear and remains visible.

     

     

    What's wrong?

     

     

    thank you very much

     

    Ugo

     

     

     

     

     

     

    stop();

    import flash.events.MouseEvent;

     

    My_img_btn1.addEventListener(MouseEvent.CLICK, play1);

    function play1 (event:MouseEvent):void {

    gotoAndStop(1);

    }

    My_img_btn2.addEventListener(MouseEvent.CLICK, play2);

    function play2 (event:MouseEvent):void {

    gotoAndStop(2);

    }

    My_img_btn3.addEventListener(MouseEvent.CLICK, play3);

    function play3(event:MouseEvent):void {

    gotoAndStop(3);

    }

    My_img_btn4.addEventListener(MouseEvent.CLICK, play4);

    function play4 (event:MouseEvent):void {

    gotoAndStop(4);

    }

     

     

    import fl.transitions.Tween;

    my_img1_mc.addEventListener(MouseEvent.ROLL_OVER, roll);

    my_img1_mc.addEventListener(MouseEvent.ROLL_OUT, roll);

    my_img2_mc.addEventListener(MouseEvent.ROLL_OVER, roll);

    my_img2_mc.addEventListener(MouseEvent.ROLL_OUT, roll);

    my_img3_mc.addEventListener(MouseEvent.ROLL_OVER, roll);

    my_img3_mc.addEventListener(MouseEvent.ROLL_OUT, roll);

    my_img4_mc.addEventListener(MouseEvent.ROLL_OVER, roll);

    my_img4_mc.addEventListener(MouseEvent.ROLL_OUT, roll);

     

     

    function roll (e:MouseEvent) {

        if (e.type == MouseEvent.ROLL_OVER) {

            e.target.parent.swapChildren(e.target,

    e.target.parent.getChildAt(e.target.parent.numChildren-1));

            var ingrandisciX:Tween = new Tween (e.target, "scaleX", null,

    e.target.scaleX, 1.8, 1, true)

            var ingrandisciY:Tween = new Tween (e.target, "scaleY", null,

    e.target.scaleY, 2.2, 1, true)

        } else {

            var riduciX:Tween = new Tween (e.target, "scaleX", null,

    e.target.scaleX, 1,2, true)

            var riduciY:Tween = new Tween (e.target, "scaleY", null,

    e.target.scaleY, 1,2, true)

        }

    }

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 25, 2013 5:11 AM   in reply to Rocco Ugo

    since you are jumping to different frames I suspect that the images 2-4 are not available when you assign the eventlisteners to them?

    you should get an error

    Also the condition

    if (e.type == MouseEvent.ROLL_OVER) {

     

    }

    seems unnecessary

     

    also the whole roll function is very complicated try to rewrite it like this

    to make it better readable

     

    function roll (e:MouseEvent) {

    switch(e.currentTarget.name){

         case "my_img1_mc": doSomething();break;

         ...

         case "my_img4_mc":doSomethingElse();break;

    }

    }

     

    you can use the same pattern to combine all your 4 play-functions into one.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points