Play swf in preloader


(Nirvan) #1

Hi, I already sold game, but sponsor need to view they ad which is in swf file. How can I load it and play. I was trying with movieClip and Video.

Edit: Ok I done something like:

[Embed(source = "../336x280_HQrect_loop.swf")] public static const DFRONT:Class;
private var vid:MovieClip = new Preloader.DFRONT;

and on stage addChild( vid );.

But around ( about 2x bigger square ) image is black outline :frowning:


(Zachary Lewis) #2

You can try setting the height and width of vd. Can you share your video?


(Nirvan) #3

I changed this but all resized, ad and this outline. Here: http://www16.zippyshare.com/v/74606844/file.html


(Zachary Lewis) #4

I meant the FlashPunk game with the video inside. Also, seeing more source would be helpful, as I can’t figure out what might be wrong with just the few lines here.


(Nirvan) #5

I think preloader class will be enough: http://shadowsgames.net/tests/Preloader.as


(Nirvan) #6

:expressionless: Can’t fix this, here is how it looks: http://shadowsgames.net/tests/ZombiesEverywhere.swf Play too fast and black border which is clicable region from ad, IT should be 336x280


(Zachary Lewis) #7

Once you’ve preloaded your game, you’ll want to remove the video using removeChild(). This will allow you to click again, since your preloader is capturing clicks.

It’s playing too fast because it’s trying to match the framerate of the movie you’re playing it from. I’m not sure how to change that.

The black border might be from the movie itself. You can use a mask to only display the parts you want, and can apply this dynamically.

vid.mask = myMask;

Here’s a tutorial on masking, if you’re unfamiliar: AS3 Masking.


(Nirvan) #8

Ok thanks, I used “shape” in mask and views ok, but framerate seams to be 2x faster than configured in file.


(Zachary Lewis) #9

In which file? Your embedded movie should play at the framerate of the movie it’s embedded in (in this case, it’ll be your FlashPunk game running at 60FPS).


(Nirvan) #10

But preloader is sprite class, engine turn on after preloading. If I change framerate in project options all is ok but 15 fps is bad for visualisation of my progress bar etc :expressionless: