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

swf in HTML

Explorer ,
Jun 04, 2011 Jun 04, 2011

I used Dreamweaver cs5 to embed my swf file in an html page.  I know that the swf is loaded and running because I can highlight some text in the initial frame.  The problem is that, everything else is blacked out.  the text is black to which is why I have to highlight it.  So it's there, I just can't do anything with it.  I know the swf runs fine in flash or flash player.

here is my html code

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="825" height="554" id="FlashID" title="Destiny's Realm">
        <param name="movie" value="TownsendFinal/final.ai.swf" />
        <param name="quality" value="high" />
        <param name="wmode" value="opaque" />
        <param name="swfversion" value="6.0.65.0" />
        <!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->
        <param name="expressinstall" value="Scripts/expressInstall.swf" />
        <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
        <!--[if !IE]>-->
        <object type="application/x-shockwave-flash" data="TownsendFinal/final.ai.swf" width="825" height="554">
          <!--<![endif]-->
          <param name="quality" value="high" />
          <param name="wmode" value="opaque" />
          <param name="swfversion" value="6.0.65.0" />
          <param name="expressinstall" value="Scripts/expressInstall.swf" />
          <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
          <div>
            <h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
            <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" /></a></p>
          </div>
          <!--[if !IE]>-->
        </object>
        <!--<![endif]-->
     </object>

any ideas would be a really big help.  This is for school and it's due soon

TOPICS
ActionScript
3.5K
Translate
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
Community Expert ,
Jun 04, 2011 Jun 04, 2011

why don't you use the html published by flash?

Translate
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
Explorer ,
Jun 04, 2011 Jun 04, 2011

Now I can't get it to work at all.  Your talking about swfobject.js right?  because I don't see any html

Translate
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
Community Expert ,
Jun 04, 2011 Jun 04, 2011

in flash, click file/publish settings and tick swf and html.  publish.  you now have an html file that you can open in your browser and your swf will play as expected (in the browser).

Translate
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
Explorer ,
Jun 04, 2011 Jun 04, 2011

thats the problem. html is selected in publish settings but I'm not getting an html file.  just a .js

Translate
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
Explorer ,
Jun 04, 2011 Jun 04, 2011

ok, ok.  Finally I found the html.  I'm still having the same problem though.  sort of.  It loads up the external files I want now.  I can see the preloader text so I know it's loaded stuff.  Then my actionscript gets stuck.  It works in the swf just not in the html.  the screen stays black and the cursor changes to the hand over the buttons but the buttons don't respond.  And the image doesn't show.  and the preloader text doesn't go away.

here is my pertinent code:

//I'm loading lots of images here, about 20 plus swf files

//I'm using my multiloader class here so this works.  it calls openingDone after the file is loaded
loader.addFile("./Images/Opening.jpg", openingDone);

//start the loader
loader.loadFiles();


//removeChild(percent_txt);
stage.addEventListener(Event.RESIZE, respotGame);

stop();

function newGame(e:Event):void{
    mainClip.removeChild(opening);
    gotoAndPlay("gameMap");
}

function setUpBtns():void{
    newGameBtn.alpha = 1;
    highScoreBtn.alpha = 1;
    instructionsBtn.alpha = 1;
    newGameBtn.addEventListener(MouseEvent.CLICK, newGame);
}

function openingDone(e:Event):void{
    opening = new Bitmap(e.target.content.bitmapData);
    opening.width = stage.stageWidth;
    opening.height = stage.stageHeight;
    mainClip.addChild(opening);
    setUpBtns();
    removeChild(percent_txt);
}

Translate
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
Community Expert ,
Jun 04, 2011 Jun 04, 2011

if you click control/test movie/test does everything work as you expect?  if yes, publish your swf and html, upload them to your website and post a link to your html.

Translate
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
Explorer ,
Jun 04, 2011 Jun 04, 2011

yep it works with the test

here's the link

http://ktownsend.shorelinevct.net/siteTownsendFinal/flash.html

thanks

Translate
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
Community Expert ,
Jun 04, 2011 Jun 04, 2011

you're trying to load http://www.shorelinevct.net/404.html into your flash?  that's not going to work in the test environment (or anywhere else).

how are you trying to do that?

Translate
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
Explorer ,
Jun 05, 2011 Jun 05, 2011

What?  the link goes right to my page and to my flash that doesn't work.  There isn't a 404 error message.  is anyone else getting a 404

Translate
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
Community Expert ,
Jun 05, 2011 Jun 05, 2011

you won't see that error message unless you're setup to do online debugging.

to solve your problem you need to look at whatever you're trying to load when preloading is complete.

Translate
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
Mentor ,
Jun 05, 2011 Jun 05, 2011

If you trying to launch the swf directly it shows:

http://ktownsend.shorelinevct.net/siteTownsendFinal/final.ai.swf

Translate
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
Explorer ,
Jun 05, 2011 Jun 05, 2011

I'm still lost.  The link I gave works on my computer and my buddy's.  Yet the other link doesn't work at all.  any help?

Translate
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
Explorer ,
Jun 05, 2011 Jun 05, 2011

http://ktownsend.shorelinevct.net/siteTownsendFinal/TownsendFinal/final.ai.swf

this is the link to go directly to it.  but I'm still having the original problem.  There should be more to my swf than this.

Translate
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
Explorer ,
Jun 05, 2011 Jun 05, 2011
Translate
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
Community Expert ,
Jun 05, 2011 Jun 05, 2011

you're getting distracted by relaxatraja's comment.  ignore that comment and continue debugging your app with the info i supplied.

Translate
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
Explorer ,
Jun 05, 2011 Jun 05, 2011

I don't understand kglad.  You're last post just says to look at what should be there when the preloading is complete.  The image I'm trying to load is on the server.  So I'm confused.  The swf should be showing the image.  so far the screen is black because the stage is black.  I reset the stage to white so now the swf is white with the title clearly showing.  some how openingDone() isn't running I think.  any ideas kglad?  thanks again

Translate
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
Community Expert ,
Jun 05, 2011 Jun 05, 2011

you're path to that image should be relative to the embedding html file, not the swf.  if that doesn't solve your problem:

1.  what's the directory/file name of your image?

2.  show your image loading code.

Translate
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
Explorer ,
Jun 05, 2011 Jun 05, 2011

the html is in the same folder as the swf.  I'll keep that in mind for future stuff but it doesn't help me here

it works in html as long as I just use the html file given to me by flash.  Now it's when I put that html file into a IFrame in my page that it goes haywire.

thanks again

loader = new MultiLoader(percentTxt);

//other loaded stuff here

loader.addFile("./Images/Opening.jpg", openingDone);

loader.loadFiles();

here is my MultiLoader Class

package  Classes{
    import flash.display.Loader;
    import flash.events.Event;
    import flash.net.URLRequest;
    import flash.events.ProgressEvent;
    import flash.events.IOErrorEvent;

    public class MultiLoader extends Loader{
        //holds all the paths
        var paths:Array;
        var func:Array;
        //holds the concurrent functions
        var loader:Loader;
        var go:Boolean;
        var percentTxt:Function;
       
        /**
         * loads multiple images easily.  percent_txt is the function in the calling .swf that
         * handles the preLoader percent txt.  Do not send the textField, instead make a function
         * which handles the textField and send MultiLoader the functionName
         */
        public function MultiLoader(percentTxt:Function = null):void{
            this.percentTxt = percentTxt;
            paths = new Array();
            func = new Array();
            loader = new Loader();
            loader.addEventListener(IOErrorEvent.IO_ERROR, catcher);
            if(percentTxt == null)
                loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, nothing);
            else
                loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, percentTxt);
            loader.contentLoaderInfo.addEventListener(Event.COMPLETE, done);
        }
       
        function nothing(e:Event):void{}
       
        //catches and traces any IOErrors
        function catcher(e:IOErrorEvent):void{trace(e);}
       
        //adds an image to load
            public function addFile(path:String, f:Function){paths.push(path);func.push(f);}
       
        /**
         * loads all the images in the stack from 1st to last
         * throws a Event.COMPLETE when all files have been loaded
         */
        public function loadFiles():void{
            paths.reverse();
            func.reverse();
            go = true;
            loadFiles2();
        }
       
        /**a helper function load load all the images*/
        private function loadFiles2():void{
            if(go && paths.length > 0){
                go = false;
                loader.load(new URLRequest(paths.pop()));
            //}else{
                //if(func.length == 0)
                    //throw new Event(Event.CHANGE);
            }
        }
       
        private function done(e:Event):void{
            e.stopPropagation();
            func.pop()(e);
            go = true;
            loadFiles2();
        }
    }
}

Translate
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
Community Expert ,
Jun 05, 2011 Jun 05, 2011

try;

loader.addFile("Images/Opening.jpg", openingDone);

Translate
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
Explorer ,
Jun 05, 2011 Jun 05, 2011

still the same problem

Translate
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
Explorer ,
Jun 05, 2011 Jun 05, 2011

So, I don't know what happened, but the flash generated html doesn't work now either.   So maybe we should start over with that.  What could be causing the code to work correctly in flash and flash player but not in the html.  anyone?  any ideas?

Translate
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
Community Expert ,
Jun 05, 2011 Jun 05, 2011

you have an incorrect path and/or file name.

Translate
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
Explorer ,
Jun 05, 2011 Jun 05, 2011

That can't be Kglad.  Sorry.  When I publish the html in flash, I'm not changing it's location.  it's located in the same folder as my .swf and my .fla.  Therefore, if the locatin in correct in the .fla then it must be correct in the published html.  yet it doens't work in the html.  its the weirdest thing ever

Translate
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
Explorer ,
Jun 05, 2011 Jun 05, 2011

and it doesn't work in the publish preview setting now either.  It used to.  still works if I hit ctrl+enter though

Translate
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