RE: [Flashcoders] Perlin Noise / Displacement

2008-10-01 Thread Karim Beyrouti
This really helped - Thank you !

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Glen Pike
Sent: 30 September 2008 21:27
To: Flash Coders List
Subject: Re: [Flashcoders] Perlin Noise / Displacement

Hi,

I did a similar thing to generate fake clouds - in a monochrome 
colour...
   
Just try generating your perlin noise as greyscale - like you are 
doing.  You should not need to do the displacement filter on it, but 
with this you can do clouds, through to big chunky stuff.  The trick 
is to overlay your perlin noise on a background colour by setting the 
blend mode to screen...

Then if you want you can adjust the brightness and contrast of your 
bitmap, then finally, apply a threshold to it...
   
Something like below:

import flash.display.BitmapData;
import flash.geom.Point;
import flash.filters.*;
Stage.scaleMode=noScale;
// Perlin noise variables
var baseX  :Number = Stage.width / 4;
var baseY  :Number = Stage.height / 2;
var nOctaves   :Number = 6;
var randomSeed :Number = Math.random()*82;
var bStitch :Boolean = false;
var bFractalNoise  :Boolean = true;
var nChannels  :Number = 1;
var bGreyScale  :Boolean= true;

// Offset array for perlin function
var p1 = new Point(45, 34);
var p2 = new Point(50, 60);
var fltPt = new Point(0, 0);
var fltRect = new Rectangle(0, 0, Stage.width, Stage.height);
 
perlinOffset = new Array(p1, p2);

var bg:MovieClip = _root.createEmptyMovieClip(bg, 
_root.getNextHighestDepth());
bg.beginFill(0xFF);//Set this to whatever colour you want your 
chrome..
bg.lineTo(Stage.width, 0);
bg.lineTo(Stage.width, Stage.height);
bg.lineTo(0, Stage.height);
bg.lineTo(0, 0);
bg.endFill();

var holder:MovieClip = _root.createEmptyMovieClip(holder, 2);
//You have a background colour underneath your perlin noise, which 
is white...
//holder.blendMode = screen;

var cloudint = setInterval(animClouds, 1000/24);
   
function animClouds() {
//change the values in the perlinOffset to animate each perlin layer
perlinOffset[0].y+=0.5;
perlinOffset[0].x+=1;
perlinOffset[1].x-=0.5;
perlinOffset[1].y-=0.25;
//apply perlin noise to our bitmapdata
bmp.perlinNoise(baseX, baseY, nOctaves, randomSeed, bStitch, 
bFractalNoise, nChannels, bGreyScale, perlinOffset);
   //
//Uncomment the following line to see the generated perlin noise
_root.holder.attachBitmap(bmp, 1, auto, true);
   
//Contrast
var cont = 3.4;
var contMtx:Array =  Array(cont,0,0,0,128*(1-cont),
0,cont,0,0,128*(1-cont),
0,0,cont,0,128*(1-cont),
   0,0,0,1,0);
   
//Brightness
var brght = -20;
var brghtMtx:Array =  Array(1,0,0,0,brght,
0,1,0,0,brght ,
0,0,1,0,brght ,
   0,0,0,1,0 );

   
var contFlt = new ColorMatrixFilter(contMtx);
var brghtFlt = new ColorMatrixFilter(brghtMtx);
//bmp.applyFilter(bmp, bmp.rectangle, fltPoint, contFlt);
//bmp.applyFilter(bmp, bmp.rectangle, fltPoint, brghtFlt);
//Harsh threshold filtering...
//bmp.threshold(bmp,bmp.rectangle,new Point(0, 
0),,0x006f6f6f,0x,0x00FF);
   


function animClouds() {
//change the values in the perlinOffset to animate each perlin layer
perlinOffset[0].y+=0.5;
perlinOffset[0].x+=1;
perlinOffset[1].x-=0.5;
perlinOffset[1].y-=0.25;
//apply perlin noise to our bitmapdata
bmp.perlinNoise(baseX, baseY, nOctaves, randomSeed, bStitch, 
bFractalNoise, nChannels, bGreyScale, perlinOffset);
   //
//Uncomment the following line to see the generated perlin noise
_root.holder.attachBitmap(bmp, 1, auto, true);
   
//Contrast
var cont = 3.4;
var contMtx:Array =  Array(cont,0,0,0,128*(1-cont),
0,cont,0,0,128*(1-cont),
0,0,cont,0,128*(1-cont),
   0,0,0,1,0);
   
//Brightness
var brght = -20;
var brghtMtx:Array =  Array(1,0,0,0,brght,
0,1,0,0,brght ,
0,0,1,0,brght ,
   0,0,0,1,0 );

   
var contFlt = new ColorMatrixFilter(contMtx);
var brghtFlt = new ColorMatrixFilter(brghtMtx);
//bmp.applyFilter(bmp, bmp.rectangle, fltPoint, contFlt);
//bmp.applyFilter(bmp, bmp.rectangle, fltPoint, brghtFlt);
//Harsh threshold filtering...
//bmp.threshold(bmp,bmp.rectangle,new Point(0, 
0),,0x006f6f6f,0x,0x00FF);
}



   

Karim Beyrouti wrote:
 Hello groovy list...

 I am trying to generate a chrome effect by applying a displacement map to
 Bitmap.
 The Displacement map is 

RE: [Flashcoders] Can URLLoader Open New Window Like LoadVars?

2008-10-01 Thread Merrill, Jason
 Not 100% sure, but you may run into problems with pop-up blocking.

I believe popup blockers are only sniffing windows spawned by Javascript, and 
not by direct user-requests, so using _blank should be fine.

Jason Merrill
Bank of America 
GCIB  Staff Support LLD
Instructional Technology  Media 
Join the Bank of America Flash Platform Developer Community 
Are you a Bank of America associate interested in innovative learning ideas and 
technologies?
Check out our internal  Innovative Learning Blog  subscribe. 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Glen Pike
Sent: Tuesday, September 30, 2008 5:44 PM
To: Flash Coders List
Subject: Re: [Flashcoders] Can URLLoader Open New Window Like LoadVars?

Hi,

I posted an answer to this yesterday -

use navigateToURL

http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/net/package.html#navigateToURL()
 


With a URLRequest having the method variable set to POST and the 
window set to _blank

Not 100% sure, but you may run into problems with pop-up blocking.

HTH

Glen

Elia Morling wrote:
 Any ideas?

 thanks

 - Original Message - From: Elia Morling [EMAIL PROTECTED]
 To: Flash Coders List flashcoders@chattyfig.figleaf.com
 Sent: Monday, September 29, 2008 12:32 AM
 Subject: [Flashcoders] Can URLLoader Open New Window Like LoadVars?


 The LoadVars could specify a target to open a new window in AS2... 
 Can we open a new window with URLLoader while making a POST operation?

 Thanks
 Elia ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders 
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



-- 

Glen Pike
01326 218440
www.glenpike.co.uk http://www.glenpike.co.uk

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] Increase Recursion Level?

2008-10-01 Thread Doug Coning
Is there an actionscript command that can increase the recursion level within a 
flash movie?  I have a legitimate method that calls itself and may exceed the 
256 recursion limitiation.

Or, is it just best not to use recursion in Flash?

Thanks,

Doug

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] Increase Recursion Level?

2008-10-01 Thread Merrill, Jason
I think recursion limits are set at the Flash player level, but not at the 
published .swf level, so even if you could increase it (I don't think you can), 
the end user could not change it.  I could be wrong.  I don't know if it's 
necessarily a huge no-no, but I would say it would be recommended to avoid 
recursion as much as possible - puts a ton of strain on the processor and the 
player.  What are you using recursion for?

Jason Merrill
Bank of America 
GCIB  Staff Support LLD
Instructional Technology  Media 
Join the Bank of America Flash Platform Developer Community 
Are you a Bank of America associate interested in innovative learning ideas and 
technologies?
Check out our internal  Innovative Learning Blog  subscribe. 


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Doug Coning
Sent: Wednesday, October 01, 2008 1:59 PM
To: Flash Coders List
Subject: [Flashcoders] Increase Recursion Level?

Is there an actionscript command that can increase the recursion level within a 
flash movie?  I have a legitimate method that calls itself and may exceed the 
256 recursion limitiation.

Or, is it just best not to use recursion in Flash?

Thanks,

Doug

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Increase Recursion Level?

2008-10-01 Thread Leandro Ferreira
I think that in player 9 it changed from 256 levels of recursion to 15s of
processing, not sure though.
Anyway, when I genuinely needed that level of recursion, I divided it in
cycles (or frames) in order to work.


   Leandro Ferreira


On Wed, Oct 1, 2008 at 3:21 PM, Merrill, Jason 
[EMAIL PROTECTED] wrote:

 I think recursion limits are set at the Flash player level, but not at the
 published .swf level, so even if you could increase it (I don't think you
 can), the end user could not change it.  I could be wrong.  I don't know if
 it's necessarily a huge no-no, but I would say it would be recommended to
 avoid recursion as much as possible - puts a ton of strain on the processor
 and the player.  What are you using recursion for?

 Jason Merrill
 Bank of America
 GCIB  Staff Support LLD
 Instructional Technology  Media
 Join the Bank of America Flash Platform Developer Community
 Are you a Bank of America associate interested in innovative learning ideas
 and technologies?
 Check out our internal  Innovative Learning Blog  subscribe.


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:
 [EMAIL PROTECTED] On Behalf Of Doug Coning
 Sent: Wednesday, October 01, 2008 1:59 PM
 To: Flash Coders List
 Subject: [Flashcoders] Increase Recursion Level?

 Is there an actionscript command that can increase the recursion level
 within a flash movie?  I have a legitimate method that calls itself and may
 exceed the 256 recursion limitiation.

 Or, is it just best not to use recursion in Flash?

 Thanks,

 Doug

 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] Increase Recursion Level?

2008-10-01 Thread Doug Coning
Yeah, I found a parameter you could pass into the SWF file that would change 
the recursion level, but wanted to see if I could do it programmatically 
through AS.

I was using recursion to load assets into a swf.  I have an array of assets 
that needed to be loaded into a SWF file.  I've set up a function that would 
pop an element off the load array and then load the asset.  Upon completion of 
the load, it would call the function again if the load array's length  0.

I will change my code to use an onEnterFrame event instead to invoke the calls 
one at a time...

Thanks,

Doug

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Merrill, Jason
Sent: Wednesday, October 01, 2008 2:22 PM
To: Flash Coders List
Subject: RE: [Flashcoders] Increase Recursion Level?

I think recursion limits are set at the Flash player level, but not at the 
published .swf level, so even if you could increase it (I don't think you can), 
the end user could not change it.  I could be wrong.  I don't know if it's 
necessarily a huge no-no, but I would say it would be recommended to avoid 
recursion as much as possible - puts a ton of strain on the processor and the 
player.  What are you using recursion for?

Jason Merrill
Bank of America
GCIB  Staff Support LLD
Instructional Technology  Media
Join the Bank of America Flash Platform Developer Community
Are you a Bank of America associate interested in innovative learning ideas and 
technologies?
Check out our internal  Innovative Learning Blog  subscribe.


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Doug Coning
Sent: Wednesday, October 01, 2008 1:59 PM
To: Flash Coders List
Subject: [Flashcoders] Increase Recursion Level?

Is there an actionscript command that can increase the recursion level within a 
flash movie?  I have a legitimate method that calls itself and may exceed the 
256 recursion limitiation.

Or, is it just best not to use recursion in Flash?

Thanks,

Doug

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders