SWF with multiple "stages" - html

Is it possible to have a single SWF file with multiple "stages" appearing at different parts of the page and sharing data?
What I'm trying to do requires sharing big amount of data (byteArrays of image data) that cannot be shared through LocalConnections or via JS (very slow) so I'm trying to avoid the "sharing" part and somehow do it in a single SWF. Problem is, those images need to appear on different parts of the page thus I'm stuck.

There is only one Stage in swfs - the Stage is effectively the background; and you cant have more than one background.
"Problem is, those images need to appear on different parts of the page" - why cant you adjust the position of the images?

Use swf 100x100 % of browser window with transparent bg (wmode='transparent'), load images and place them in appropriate position. Main problem how to calculte coordinates for thumbnails... ^)
And flash with transparent bg very slow too...

Related

Should i make different texture pack for each image button in libgdx?

I am using 12 image buttons in my game, should i make a single texture pack for all buttons or make different .pack file and .png for each and every image button?
You should use the least amount of images possible to reduce the amount of images that need loaded into memory.
"The main reason to use a texture packer is that loading individual
images is expensive. Loading 200 small images would take a lot of
processing time whereas loading 1 image and using portions of that
image would use a considerably smaller amount."
Quote from gamedevelopment.blog

How to delay loading of large background image

How can I delay /defer the loading of large background image? The reason am asking this question is because I have a poor score for "first meaningful paint" When I run performance tests on the page. I have tried reducing image size as much as possible.
If it is a background image you can use the Javascript onLoad event. This event excutes only after the whole page is finished loading.
Example:
function loadBGIMG(){
document.getElementById("any-menu").style.backgroundImage="url(../images/any-menu.jpg)";
}
window.onload=loadBGIMG();
First meaningful paint (I'll call it FMP) doesn't have to be an image. If FMP doesn't have to be the background image (it can be a h1, p or other elemnets), you can probably separate the line referencing the image in a separate file so that other components can be painted without being blocked by downloading the image.

Flash Video Loading Issue

Please click on the below link
http://hpecp.vmokshagroup.com/videobook/html/homepage.html
When we click on "What is VideoBook" link we got some blank screen before starting the swf file due to video fetching from the server. We have to avoid blank screen.
We are facing a problem of fetching the video clips from the hosting server. I added two video clips in Flash (.swf)... one is from the beginning, another one is at the ending and in between some text animations.
While we are playing/calling .swf file in browser from hosting server, initially getting blank screen. It takes some time to fetching the video clip from server due to size. Starting of first video clip duration is about 3-6 seconds. While video is being loaded.. text animation is starting without playing first video clip. Same problem we are facing in second video at the ending.
Is there any option to incorporate video clips internally in Flash (.swf file) rather than calling from external server or external file path?
Any help would be appreciated.
This happens because of the JavaScript that you use - it actually makes the swf files (in)visible depending on the situation. What this does is that it actually loads the .swf files each time. You can check that in the Network tab of your debugger (I'm using Chrome).
So it first loads Video-01d.swf, or Video-02.swf. They take time to load, and just when the main file is loaded, it starts to load the video file (video1.flv).
All that causes delay, and it's pretty normal as you have all that things in separate files. If you want to, you can merge them into one - just import the flv inside your .swf file and it will work out well..
Of course, you will need to change all your logic for the flash files that you are playing. You will also need to change the JavaScript to call Flash functions in order to tell it to go to another "scene".
I will advise you to add a simple gif loader image (like this), put it as a background-image of the div, and put some color into that div. What the user will see is that the movie disappears, there is a black background with a loading symbol inside, and then the new video begins. It's a normal thing to see online - preloaders :) Good luck!

AS3 - Using sprite sheets to optimize my games

So, I'm trying to make my flash "games" run more smoothly. I am using individual PNG files for each of my objects in order to create player animations.
I've heard from some places that using individual files like that is bad.
I heard about using sprite sheets in order to compress data and reduce memory usage.
Maybe I have it wrong, but is there a way to merge all of my PNG images (with transparency) together in such a way that flash can continue to use the images individually?
I am really looking for ways to make my programs run more smoothly in order to be able to have lots of images on screen without much lag. Any ideas on how I can make things run better?
Here is an example of a tile based game I'm trying to make that is having serious lag issues.
TexturePacker allows merge png files. It generates two files: png and config file. Png is just merged images and config file is txt file which you can load into your swf, parse and demerge your images using it. Config could be in various formats for different game engines.
Using Photoshop or similar software you would combine all of the animations frames into one file. The size and shape of the file can be whatever you want, but each of the 'frames' should be the same size, in the same order and with no space between them. For example, lets say each frame is 25x25px, your walk animation is 10 frames and you want the final .png to be one long strip. You would make a new .png with the dimensions of either 250X25 or 25X250 and then insert all of your frames into that one file in the order of the animation. It's up to you if you want to embed these as display object or files that get loaded, but once you have them you just need to use BitmapData to break up the input file into new BitmapData objects and then display them as needed. Going one step further, lets say that most if not all characters have a walk animation and an action animation, you would make a single class to deal with loading character animations and the first row of the image file would be the walk animation and the second would be the action animation.

comparing image in cocos2d-x

I'm making a game with cocos2d-x HTML5.
On one layer there are two images which is almost same but have several different area and when I click one of them, if the clicked area of two images has a different pixel, I want to add a sticker to the same location to both images.
I want to ask that how can i compare the image pixel on cocos2d-x HTML5?
and how do I make the click event to place the sticker?
Probably CCImage class will help you.
What I suggest is, as you already have 2 images, and you have know the different area,
you can create a plist Dictionary recording the area position and size.
In your game scene, you can add transparent touchable Sprite created from your config list file, and set a color to it when it is touched.