eXtreme Intelligence talk related to internet technologies
Log in  | Register  | Set Adsense  | Search   |  New Posts  |   My Profile |  Contact Us

Make money by posting...
You can make money by just posting at XiTalk forums now. more details
Username:    Password: or click here to register

Multimedia and Graphics Design 
BeginBitmapFill () method for SWF8 / Fill your stage with cu - Save this topic
XiTalk Forum Index > Multimedia and Graphics Design


          BeginBitmapFill () method for SWF8 / Fill your stage with cu View previous topic . View next topic
Author
Post Details
 
minopharma
Just Born



Stars :
Status : Offline
Join Date: 11 Feb 2007
Posts: 8
Location: Skopje, Macedonia

PostPosted: Tue Feb 13, 2007 11:27 pm    BeginBitmapFill () method for SWF8 / Fill your stage with cu - Save this post Reply with quote
BeginBitmapFill( ) method for SWF8

Are you tired of trying to make your movie transparent?Or making a custom pattern in HTML, with importing the gif or bitmap tile image to make a cool background?When you use some of this solution above, it's possible to get some errors of your movie components function ( for example:mouse wheel function not working in Flash/Swishmax scrollbars if you use transparency in HTML).

So, forget all of this problems and try with new BeginBitmapFill( ) method for SWF8, now for Swishmax!

1.Open Swishmax build 2005.11.16, and import your tile image(*.bmp,*.gif,*.jpg or *.png) into the stage.Save the file as bg.swi.

2.Now click on the image and goto the transform panel and make this settings: X=0,Y=0 and set the anchor point to TopLeft.

3.Now open the Shape tab, and from the preview window, get the width and height of your image(in my example the dimensions of my image are 4x4).

4.Now, group your image as sprite and add sprite instance name brush0.With brush0 sprite still selected, open transform panel, and make this settings: X=0, Y=0 and set the anchor point to TopLeft.

5.Click on the Scene_1 in the Outline panel (tree), open the Script tab, and add this code:

Code:
function setUpStage(){
Stage.align = "TL";
Stage.scaleMode = "noScale";
var a = new Object();
a.onResize = drawBackGround;
Stage.addListener(a);
drawBackGround();
}
function onEnterFrame(){
b.fillRect(b.rectangle);
var li = 0;
while (li <3){
var c = this[clips[li]];
var d = c.transform.matrix;
var e = d.tx % textureWidth;
var f = d.ty % textureHeight;
var g = 0;
while (g < 4){
var h = 0;
while (h < 4){

b.draw(c, d);
h++;
}
g++;
}
li++;
}
}
function drawBackGround(){
with (_level0) {
beginBitmapFill(b);
moveTo(0, 0);
lineTo(Stage.width, 0);
lineTo(Stage.width, Stage.height);
lineTo(0, Stage.height);
lineTo(0, 0);
endFill();
}
}
onFrame (1) {
var textureWidth = 4;
var textureHeight = 4;
var b=new flash.display.BitmapData(textureWidth, textureHeight);
var clips = Array("brush0");
var i = 0;
while (i < clips.length){
this[clips[i]]._visible = false;
i++;
}
setUpStage();
}


5.Make sure that the SWF Export option is set to SWF8, and export your movie as SWF8 as bg.swf in a folder.

6.Now, open Frontpage or Dreamweaver and add this code:

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML lang=en xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE>Flash 8 background pattern with bitmap fill</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<STYLE type=text/css>BODY {
PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; WIDTH: 100%; PADDING-TOP: 0px; HEIGHT: 100%
}
HTML {
PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; WIDTH: 100%; PADDING-TOP: 0px; HEIGHT: 100%
}
</STYLE>

<META content="MSHTML 6.00.2900.2096" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff><!--url's used in the movie--><!--text used in the movie-->
<OBJECT id=bgPattern
codeBase=http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0
height="100%" width="100%" align=middle
classid=clsid:d27cdb6e-ae6d-11cf-96b8-444553540000><PARAM NAME="allowScriptAccess" VALUE="sameDomain"><PARAM NAME="movie" VALUE="bg.swf"><PARAM NAME="quality" VALUE="high"><PARAM NAME="bgcolor" VALUE="#ffffff">
<embed src="bg.swf" quality="high" bgcolor="#ffffff" width="100%"
height="100%" name="bgPattern" align="middle" allowScriptAccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer" />
</OBJECT></BODY></HTML>


7.Save your file as bg.html in the same folder as your swf file.

8.That's it!Now test your swf file in bg.html browser on different resolutions(right click Desktop/Properties/Settings) and Enjoy! :bigwink:

Note: If you want to use this with different tile image, just follow this steps, get the dimensions of your image (step3) and make changes this in the code in Frame1.

For example: If your new image is 10x10 (width/height), just add this numbers in the beginning of the Frame1 code:

var textureWidth =10;
var textureHeight = 10;

Preview and download link:

http://www.swish-db.com/forum/index.php?showtopic=20616&hl=minopharma

Copyright 2006, Pseudohybriddesign
Back to top
View user's profile Send private message Visit poster's website  Rating: Acknowledged
Advertisement
Advertiser








PostPosted: Tue Feb 13, 2007 11:27 pm    Advertisement - Save this post

Back to top
calvin
Just Born



Stars :
Status : Offline
Join Date: 04 Feb 2007
Posts: 33

PostPosted: Wed Feb 14, 2007 1:03 am     - Save this post Reply with quote
thank minopharma, it seems you have pretty good experience with that tool swishmax, I am just learning it at swish-db.
Back to top
View user's profile Send private message
awalsadja
Guru Wanabe



Stars :
Status : Offline
Join Date: 13 Feb 2007
Posts: 103
Location: Balikpapan - Indonesia

PostPosted: Sun Mar 25, 2007 8:01 am     - Save this post Reply with quote
great tutorial
i save your post.
_________________
| My Multimedia Project |
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
killer
Guru Wanabe



Stars :
Status : Offline
Join Date: 04 Feb 2007
Posts: 144

PostPosted: Mon Mar 26, 2007 12:00 am     - Save this post Reply with quote
thank you minopharma !!!
_________________
cheers
Don't have signature Sad
Back to top
View user's profile Send private message
Display posts from previous:   

Page 1 of 1
XiTalk Forum Index > Multimedia and Graphics Design




 
Jump to:  
   Similar threads/topics
 Topics   Replies   Author   Views   Last Post 
No new posts Plss. help me I cant make a program of this in turbo c? 3 jm 13927 Sat Aug 25, 2007 7:16 pm
Ali Imran View latest post
No new posts How do I Accept transfer for my change of domain registrar? 1 Eve N 10249 Fri Mar 16, 2007 3:04 pm
Tuan V View latest post
No new posts how do i get rid of the 3-5sec pauses between chapters in ne 0 rhos 13082 Tue Mar 20, 2007 6:12 am
rhos View latest post
No new posts Net copes with key character test 0 gogul2k 4743 Tue Mar 13, 2007 10:43 pm
gogul2k View latest post
No new posts this is test.. 0 XiTalk 12393 Sun Feb 04, 2007 2:34 pm
XiTalk View latest post

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum