Re: [Flashcoders] Bitwise selection

2009-04-03 Thread Jiri

So each element in a ByteArray can hold 8 bits.
What about the readInt() method of the ByteArray, does an integer then 
span over 4 elements of the bytearray. And if I start at position 0 and 
then call the readInt(), is the position after that then 4?


Jiri

Kerry Thompson wrote:

Jiri wrote:


Nice, that you took the time to write that post. It is much appreciated.


Thanks, Jiri.

One other thing worth mentioning is that an integer is actually 4 bytes, so
you have 32 bits. I kept my example to one byte for simplicity. If you want
to do operations on a single byte, you can use ByteArray elements.

Other bitwise operators to check out are XOR (exclusive OR, which means one
or the other is on, but not both) and shift operators  and  to check the
value of a particular bit.

Cordially,

Kerry Thompson

___
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] isseu with a custom function in AS2

2009-04-03 Thread jimmi
Good morning,

I have made a function that adds interpunction marks to a value, for
example the value 1 gets changed to 10.000, 10 to 100.000 and
so forth.

The function work fine, but I'm trying to make it reusable so that i
can use it in a large scale project. That's where the problem comes
up.

This is what the working code looks like:


var outputNumber:Number = 1 // input value
var outputString:String = new String();

function init ()
{
outputString = String(Number(outputNumber));
interpunk (outputString);

trace(outputNumber); // output is 1
trace(outputString); // output is 10.000
}

function interpunk (par1):Void
{
trace(par1)
switch (par1.length)
{
case 4 :
outputString = String(par1.charAt (0) + . + 
par1.slice (1))
break;

case 5 :
outputString = String(par1.charAt (0) + par1.charAt (1) 
+ . +
par1.slice (2))
break;

case 6 :
outputString = String(par1.charAt (0) + par1.charAt (1) 
+
par1.charAt (2) + . + par1.slice (3))
break;

default :
outputString = String(par1)
break;
}
}

init ();



So i tried to make it reusable, so i tried this(changed outputString to par1).
But now the value comes out unchanged so 1 stays 1, while i
expected it to become 10.000.


I hope someone can help i the right direction.

This is what the non working code looks like :


function interpunk (par1):Void
{
trace(par1)
switch (par1.length)
{
case 4 :
par1 = String(par1.charAt (0) + . + par1.slice (1))
break;

case 5 :
par1 = String(par1.charAt (0) + par1.charAt (1) + . + 
par1.slice (2))
break;

case 6 :
par1 = String(par1.charAt (0) + par1.charAt (1) + 
par1.charAt (2) +
. + par1.slice (3))
break;

default :
par1 = String(par1)
break;
}
}


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


Re: [Flashcoders] isseu with a custom function in AS2

2009-04-03 Thread Hans Wichman
Hi Jimmi,

your parameter is being passed by value not object since it's a literal
value.
In your previous situation the function applied itself to a global variable
so this problem didn't occur.

Add a return statement to your function at the end:
function interpunk (par1):Void {
.
return par1;
}

And call it like: outputString = interpunk (outputString);

Note however that reassigning parameter values is not considered good
practice, and you should avoid it.


HTH
JC

On Fri, Apr 3, 2009 at 10:19 AM, jimmi cho...@gmail.com wrote:

 Good morning,

 I have made a function that adds interpunction marks to a value, for
 example the value 1 gets changed to 10.000, 10 to 100.000 and
 so forth.

 The function work fine, but I'm trying to make it reusable so that i
 can use it in a large scale project. That's where the problem comes
 up.

 This is what the working code looks like:


 
 var outputNumber:Number = 1 // input value
 var outputString:String = new String();

 function init ()
 {
outputString = String(Number(outputNumber));
interpunk (outputString);

trace(outputNumber); // output is 1
trace(outputString); // output is 10.000
 }

 function interpunk (par1):Void
 {
trace(par1)
switch (par1.length)
{
case 4 :
outputString = String(par1.charAt (0) + . +
 par1.slice (1))
break;

case 5 :
outputString = String(par1.charAt (0) + par1.charAt
 (1) + . +
 par1.slice (2))
break;

case 6 :
outputString = String(par1.charAt (0) + par1.charAt
 (1) +
 par1.charAt (2) + . + par1.slice (3))
break;

default :
outputString = String(par1)
break;
}
 }

 init ();


 

 So i tried to make it reusable, so i tried this(changed outputString to
 par1).
 But now the value comes out unchanged so 1 stays 1, while i
 expected it to become 10.000.


 I hope someone can help i the right direction.

 This is what the non working code looks like :


 
 function interpunk (par1):Void
 {
trace(par1)
switch (par1.length)
{
case 4 :
par1 = String(par1.charAt (0) + . + par1.slice
 (1))
break;

case 5 :
par1 = String(par1.charAt (0) + par1.charAt (1) +
 . + par1.slice (2))
break;

case 6 :
par1 = String(par1.charAt (0) + par1.charAt (1) +
 par1.charAt (2) +
 . + par1.slice (3))
break;

default :
par1 = String(par1)
break;
}
 }


 
 ___
 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] Flashplayer positioning

2009-04-03 Thread Glen Pike

Hi,

   I tried the Stage.align but this has no effect.

   The stage size is the same as the monitor size.

   Looking into this further, it seems to be an issue with the Window 
Manager - if we run X11 with no Window Manager and start Flashplayer 
from the command line it can't seem to position itself properly.  If we 
run Flash with a Window Manager / Desktop, e.g. xfce, it aligns fine.  I 
am guessing something changed in FP10 relating to X11 but what...


   Glen

Taka Kojima wrote:

not sure, maybe FP10 defaults to a different stage alignment. Maybe
try explicity stating the stage alignment and see if that fixes it.

- Taka

On Thu, Apr 2, 2009 at 11:16 AM, Glen Pike postmas...@glenpike.co.uk wrote:
  

Hi,

  There is stuff offstage, but I am not sure if it is in a guide layer or
not - will check later.

  Why this would happen in FP10 and not 9 though??

  Glen

Joel Stransky wrote:


Is there any off-stage content that might be causing this?

On Thu, Apr 2, 2009 at 12:42 PM, Glen Pike
g...@engineeredarts.co.ukwrote:


  

Hi,

 I have just setup FP10 in standalone on my Gentoo Linux box and am
running a SWF from the command line in standalone mode.

 The x, y position of my SWF is all wrong - the SWF is positioned mostly
off the screen.  Reverting to FP9 standalone it works fine.

 The SWF is compiled for AS2.

 Does anyone have any ideas about this??
   Ta

 Glen
___
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 mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] Loading MC

2009-04-03 Thread Karl DeSaulniers

Hello all and good morning,
I was wondering if I could get some help on this.
I have been trying for days now to figure this out.
I know there is some little thing I am missing
and its probably right under my nose so to speak.

Here is my code:

//--
// Start Image loader
//--

import com.martijndevisser.ImageLoader;

_root.stage_mc.attachMovie(LargePic,LargePic +  
ID,this.getNextHighestDepth());

_root.stage_mc[LargePic + ID].ID = ID;
_root.stage_mc[LargePic + ID]._x = originalX;
_root.stage_mc[LargePic + ID]._y = originalY;
var mcProgress:Number = 0;

var checkLoader:Object = new Object();
checkLoader.onLoadStart = function(target:MovieClip):Void  {
trace(Start Width: + _root.stage_mc[LargePic + ID].previewW);
trace(Start Height: + _root.stage_mc[LargePic + ID].previewH);
_root.stage_mc[LargePic + ID].newPic.spiralLoader._visible = true;
_root.stage_mc[LargePic + ID].newPic.spiralLoader.gotoAndPlay(2);
};
checkLoader.onLoadComplete = function(target:MovieClip) {
target = _root.stage_mc[LargePic + ID].newPic.Image_mc;
_root.stage_mc[LargePic + ID].newPic.percentCom.text = ;
_root.stage_mc[LargePic + ID].newPic.spiralLoader.stop();
_root.stage_mc[LargePic + ID].newPic.spiralLoader.gotoAndStop(1);
_root.stage_mc[LargePic + ID].newPic.spiralLoader._visible = false;
target._width = target._width / 3;
target._height = target._height / 3;
	_root.stage_mc[LargePic + ID].previewW = _root.stage_mc[LargePic  
+ ID].newPic._width;
	_root.stage_mc[LargePic + ID].previewH = _root.stage_mc[LargePic  
+ ID].newPic._height;

trace(End Width: + _root.stage_mc[LargePic + ID].previewW);
trace(End Height: + _root.stage_mc[LargePic + ID].previewH);
};
checkLoader.onLoadProgress = function(target:MovieClip,  
bytesLoaded:Number, bytesTotal:Number):Void  {

mcProgress = Math.ceil((bytesLoaded / bytesTotal) * 100);
	_root.stage_mc[LargePic + ID].newPic.percentCom.text =  
mcProgress.toString() + %;

};
var loader:ImageLoader = new ImageLoader(_root.stage_mc[LargePic +  
ID].newPic.Image_mc);

loader.addListener(checkLoader);
loader.loadImage(_global.projectPic,_root.stage_mc[LargePic +  
ID].newPic.Image_mc);


//--
// End Image Loader
//--


To explain further, I have a oversized image loading at first which  
is sized down 3 times.
Once it sizes down, I want previewW and previewH to equal the new  
width and height.
Everything loads fine, it loads and the progress runs and it resizes  
fine,
but when I hit my resize button to make it smaller, the variables  
previewW and previewH
take on the dimensions of _root.stage_mc[LargePic +  
ID].newPic.Image_mc  before anything was loaded into it.
(my resize button works off of the previewW and previewH vairables,  
this info is just FYI)

var fitSizeW:Number = previewW;
var fitSizeH:Number = previewH;
var maxSizeW:Number = (previewW * 3);
var maxSizeH:Number = (previewW * 3);
var minSizeW:Number = (previewW / 3);
var minSizeH:Number = (previewH / 3);

Note: I have to keep previewW and previewH also because I have a  
mousescroll attached to that variable as well.


I have a feeling that because the ImageLoader class loads a dummy MC  
for the bitmap
and then removes it to place the img MC for smoothing, my script is  
not getting the final value
of what is loaded into it and so previewW and previewH do not inherit  
its final values, just its beginning values.
There is a background bitmap that gets replaced by the loaded image  
that is in the MC when it is placed on stage.

This is the beginning value.

This is in AS2 BTW.

Any help would be GREATLY appreciated at this point.

THX

Karl DeSaulniers
Design Drumm
http://designdrumm.com

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


RE: [Flashcoders] Bitwise selection

2009-04-03 Thread Kerry Thompson
Jiri wrote:

 So each element in a ByteArray can hold 8 bits.
 What about the readInt() method of the ByteArray, does an integer then
 span over 4 elements of the bytearray. And if I start at position 0 and
 then call the readInt(), is the position after that then 4?

Essentially, yes. A ByteArray is a packed array of bytes. Or, put another
way, it stores the most compact representation of a data type, but you can
still access each byte with the [] array access.

Consider the following (e-mail AS3--don't count on it to be bug-free):

var myByteArr:ByteArray = new ByteArray();

myByteArr.writeInt (2695938256);
trace (myByteArr.length);   //4
trace (myByteArr[0]);   //208
trace (myByteArr[1]);   //192
trace (myByteArr[2]);   //176
trace (myByteArr[3]);   //160

trace (myByteArr.readInt());//2695938256

I chose that rather odd number because it was a convenient hex number,
#A0B0C0D0. Doing a trace on a ByteArray element returns the decimal
equivalent of the byte.

It's possible I got the order reversed--I didn't test the code. #A0 might be
in the 0th element. Nonetheless, I think the code represents the concept
reasonably well.

Cordially,

Kerry Thompson

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


Re: [Flashcoders] isseu with a custom function in AS2

2009-04-03 Thread Geografiek

Hi Jimmi,
I made a class that does just that (and a little bit more).
I can send it to you off list if you wish.
HTH,
Willem van den Goorbergh
Op 3-apr-2009, om 10:19 heeft jimmi het volgende geschreven:


Good morning,

I have made a function that adds interpunction marks to a value, for
example the value 1 gets changed to 10.000, 10 to 100.000 and
so forth.

The function work fine, but I'm trying to make it reusable so that i
can use it in a large scale project. That's where the problem comes
up.

This is what the working code looks like:

// 
//

var outputNumber:Number = 1 // input value
var outputString:String = new String();

function init ()
{
outputString = String(Number(outputNumber));
interpunk (outputString);

trace(outputNumber); // output is 1
trace(outputString); // output is 10.000
}

function interpunk (par1):Void
{
trace(par1)
switch (par1.length)
{
case 4 :
outputString = String(par1.charAt (0) + . + 
par1.slice (1))
break;

case 5 :
outputString = String(par1.charAt (0) + par1.charAt (1) + 
. +
par1.slice (2))
break;

case 6 :
outputString = String(par1.charAt (0) + par1.charAt (1) 
+
par1.charAt (2) + . + par1.slice (3))
break;

default :
outputString = String(par1)
break;
}
}

init ();

// 
//


So i tried to make it reusable, so i tried this(changed  
outputString to par1).

But now the value comes out unchanged so 1 stays 1, while i
expected it to become 10.000.


I hope someone can help i the right direction.

This is what the non working code looks like :

// 
//

function interpunk (par1):Void
{
trace(par1)
switch (par1.length)
{
case 4 :
par1 = String(par1.charAt (0) + . + par1.slice (1))
break;

case 5 :
			par1 = String(par1.charAt (0) + par1.charAt (1) + . +  
par1.slice (2))

break;

case 6 :
par1 = String(par1.charAt (0) + par1.charAt (1) + 
par1.charAt (2) +
. + par1.slice (3))
break;

default :
par1 = String(par1)
break;
}
}

// 
//

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


=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
Geografiek is a Dutch, Utrecht-based map and chart design company.
Willem van den Goorbergh can be contacted by telephone: (+31) 
30-2719512 or cell phone: (+31)6-26372378

or by fax: (+31)302719687
snail mail: Hooghiemstraplein 89 3514 AX UTRECHT
Visit our website at: http://www.geografiek.nl
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=




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


Re: [Flashcoders] isseu with a custom function in AS2

2009-04-03 Thread jimmi
Hey guys thanks for the feedback. Willem i would love to have that
class of yours.

On Fri, Apr 3, 2009 at 12:58 PM, Geografiek geograf...@geografiek.nl wrote:
 Hi Jimmi,
 I made a class that does just that (and a little bit more).
 I can send it to you off list if you wish.
 HTH,
 Willem van den Goorbergh
 Op 3-apr-2009, om 10:19 heeft jimmi het volgende geschreven:

 Good morning,

 I have made a function that adds interpunction marks to a value, for
 example the value 1 gets changed to 10.000, 10 to 100.000 and
 so forth.

 The function work fine, but I'm trying to make it reusable so that i
 can use it in a large scale project. That's where the problem comes
 up.

 This is what the working code looks like:


 
 var outputNumber:Number = 1 // input value
 var outputString:String = new String();

 function init ()
 {
        outputString = String(Number(outputNumber));
        interpunk (outputString);

        trace(outputNumber); // output is 1
        trace(outputString); // output is 10.000
 }

 function interpunk (par1):Void
 {
        trace(par1)
        switch (par1.length)
        {
                case 4 :
                        outputString = String(par1.charAt (0) + . +
 par1.slice (1))
                        break;

                case 5 :
                        outputString = String(par1.charAt (0) + par1.charAt
 (1) + . +
 par1.slice (2))
                        break;

                case 6 :
                        outputString = String(par1.charAt (0) + par1.charAt
 (1) +
 par1.charAt (2) + . + par1.slice (3))
                        break;

                default :
                        outputString = String(par1)
                        break;
        }
 }

 init ();


 

 So i tried to make it reusable, so i tried this(changed outputString to
 par1).
 But now the value comes out unchanged so 1 stays 1, while i
 expected it to become 10.000.


 I hope someone can help i the right direction.

 This is what the non working code looks like :


 
 function interpunk (par1):Void
 {
        trace(par1)
        switch (par1.length)
        {
                case 4 :
                        par1 = String(par1.charAt (0) + . + par1.slice
 (1))
                        break;

                case 5 :
                        par1 = String(par1.charAt (0) + par1.charAt (1) +
 . + par1.slice (2))
                        break;

                case 6 :
                        par1 = String(par1.charAt (0) + par1.charAt (1) +
 par1.charAt (2) +
 . + par1.slice (3))
                        break;

                default :
                        par1 = String(par1)
                        break;
        }
 }


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

 =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
 Geografiek is a Dutch, Utrecht-based map and chart design company.
 Willem van den Goorbergh can be contacted by telephone: (+31)30-2719512 or
 cell phone: (+31)6-26372378
 or by fax: (+31)302719687
 snail mail: Hooghiemstraplein 89 3514 AX UTRECHT
 Visit our website at: http://www.geografiek.nl
 =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=




 ___
 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] Duplicating a loaded SWF

2009-04-03 Thread Henry Cooke
hej folks,
I'm writing an assetloader class, with the intention of attaching a whole
bunch of instances to the stage of a loaded asset. Because I want to attach
more than one instance of the loaded SWF, I'm having to duplicate the asset
instead of just using addChild, because you can only addChild one instance
of an object to the stage at a time.

So, I've written the following function in a class which extends Loader:

public function get asset():DisplayObject{

var cn:String = getQualifiedClassName( contentLoaderInfo.content );

var c:Class = Class( contentLoaderInfo.applicationDomain.getDefinition( cn )
);

return( DisplayObject( new c() ) );

//return( contentLoaderInfo.content );

}

However, when I try to use the duplicated asset, I can't control its
timeline, and any sound on that timeline is heard whether it's attached to
the stage or not. Basically, I suspect that duplicating the asset is
mangling its timeline somehow. Uncommenting the commented return and
commenting everything else out gives me a movieclip that behaves how I
expect, but of course can only be attached to the stage once.

Has anyone tried stuff like this before (duplicating a loaded SWF with
timeline intact)?

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


Re: [Flashcoders] Duplicating a loaded SWF

2009-04-03 Thread Ian Thomas
Henry,
   As far as I'm aware, duplication of existing instances of objects
is still something sadly lacking in Flash. There are a number of
hacks,  but none of them seem to work for all cases (I've tried a
bunch!).

  In your case, I have two suggestions; both are a change of approach:

i) Use the loaded SWF simply as a container for a symbol definition
(in the loaded SWF's library) and create lots of new instances of that
symbol - that is perfectly normal and works fine.

or

ii) Actually load multiple instances of the SWF. This isn't anything
like as heavyweight/slow as you might expect (and was the way to do it
in AS2) as the SWF will be in the browser's cache.

HTH,
   Ian

On Fri, Apr 3, 2009 at 12:49 PM, Henry Cooke
aninfinitenumberofmonk...@gmail.com wrote:
 hej folks,
 I'm writing an assetloader class, with the intention of attaching a whole
 bunch of instances to the stage of a loaded asset. Because I want to attach
 more than one instance of the loaded SWF, I'm having to duplicate the asset
 instead of just using addChild, because you can only addChild one instance
 of an object to the stage at a time.

 So, I've written the following function in a class which extends Loader:

 public function get asset():DisplayObject{

 var cn:String = getQualifiedClassName( contentLoaderInfo.content );

 var c:Class = Class( contentLoaderInfo.applicationDomain.getDefinition( cn )
 );

 return( DisplayObject( new c() ) );

 //return( contentLoaderInfo.content );

 }

 However, when I try to use the duplicated asset, I can't control its
 timeline, and any sound on that timeline is heard whether it's attached to
 the stage or not. Basically, I suspect that duplicating the asset is
 mangling its timeline somehow. Uncommenting the commented return and
 commenting everything else out gives me a movieclip that behaves how I
 expect, but of course can only be attached to the stage once.

 Has anyone tried stuff like this before (duplicating a loaded SWF with
 timeline intact)?

 h.
 ___
 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] Duplicating a loaded SWF

2009-04-03 Thread Cédric Tabin
Hello,

Usually for that kind of problem, I simple load my SWF as binary data and
use Loader.loadBytes to retrieve many instances of the content. Maybe tha'ts
a solution for you ?

Regards,
Cedric

On Fri, Apr 3, 2009 at 2:35 PM, Ian Thomas i...@eirias.net wrote:

 Henry,
   As far as I'm aware, duplication of existing instances of objects
 is still something sadly lacking in Flash. There are a number of
 hacks,  but none of them seem to work for all cases (I've tried a
 bunch!).

  In your case, I have two suggestions; both are a change of approach:

 i) Use the loaded SWF simply as a container for a symbol definition
 (in the loaded SWF's library) and create lots of new instances of that
 symbol - that is perfectly normal and works fine.

 or

 ii) Actually load multiple instances of the SWF. This isn't anything
 like as heavyweight/slow as you might expect (and was the way to do it
 in AS2) as the SWF will be in the browser's cache.

 HTH,
   Ian

 On Fri, Apr 3, 2009 at 12:49 PM, Henry Cooke
 aninfinitenumberofmonk...@gmail.com wrote:
  hej folks,
  I'm writing an assetloader class, with the intention of attaching a whole
  bunch of instances to the stage of a loaded asset. Because I want to
 attach
  more than one instance of the loaded SWF, I'm having to duplicate the
 asset
  instead of just using addChild, because you can only addChild one
 instance
  of an object to the stage at a time.
 
  So, I've written the following function in a class which extends Loader:
 
  public function get asset():DisplayObject{
 
  var cn:String = getQualifiedClassName( contentLoaderInfo.content );
 
  var c:Class = Class( contentLoaderInfo.applicationDomain.getDefinition(
 cn )
  );
 
  return( DisplayObject( new c() ) );
 
  //return( contentLoaderInfo.content );
 
  }
 
  However, when I try to use the duplicated asset, I can't control its
  timeline, and any sound on that timeline is heard whether it's attached
 to
  the stage or not. Basically, I suspect that duplicating the asset is
  mangling its timeline somehow. Uncommenting the commented return and
  commenting everything else out gives me a movieclip that behaves how I
  expect, but of course can only be attached to the stage once.
 
  Has anyone tried stuff like this before (duplicating a loaded SWF with
  timeline intact)?
 
  h.
  ___
  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] Bitwise selection

2009-04-03 Thread Mark Winterhalder
On Fri, Apr 3, 2009 at 8:38 AM, Jiri jiriheitla...@googlemail.com wrote:
 So each element in a ByteArray can hold 8 bits.
 What about the readInt() method of the ByteArray, does an integer then span
 over 4 elements of the bytearray. And if I start at position 0 and then call
 the readInt(), is the position after that then 4?

Yes, and you can use readUnsignedByte(), too, for example, but if
you're trying to use a ByteArray to store bit flags, then we can
probably help you find a more elegant way to do what you want.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] Scroll image line probleme AS2

2009-04-03 Thread natalia Vikhtinskaya
Hi to all people in this list.
Please help me with code. I want to scroll image line as on this site
http://www.vincentpetersphotography.com/
Look please at any gallery.

Here is my example
http://www.natavi.co.uk/test/gallery_mouse.html
I don’t like how my scrolling works. It stops sometimes, it’s too fast
in the middle area, it should not have constant speed on the border. I
use this code for mc contents:

var scrollRatio=(contents._width-boxW)/boxW;
var centerX=contents._x;

contents.onEnterFrame=function(){
if (_root._xmouse=left  _root._xmouse=right){
 var scrollpos = -_root._xmouse;
var newPos = centerX+Number(((scrollpos+left)*scrollRatio));
var active=true;
}
if (active){
difX = newPos - this._x;
this._x = this._x + difX / 5;
}
if(Math.abs(difX)0.01){
this._x=newPos;
delete active;
delete difX;
}

}

Can anybody share with code for correct scrolling or example? Thanks in advance.

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


Re: [Flashcoders] Duplicating a loaded SWF

2009-04-03 Thread Henry Cooke
Thanks chaps,
In the end, loadBytes did the trick.

Cheers,
h.

2009/4/3 Cédric Tabin tabin.ced...@gmail.com

 Hello,

 Usually for that kind of problem, I simple load my SWF as binary data and
 use Loader.loadBytes to retrieve many instances of the content. Maybe
 tha'ts
 a solution for you ?

 Regards,
 Cedric

 On Fri, Apr 3, 2009 at 2:35 PM, Ian Thomas i...@eirias.net wrote:

  Henry,
As far as I'm aware, duplication of existing instances of objects
  is still something sadly lacking in Flash. There are a number of
  hacks,  but none of them seem to work for all cases (I've tried a
  bunch!).
 
   In your case, I have two suggestions; both are a change of approach:
 
  i) Use the loaded SWF simply as a container for a symbol definition
  (in the loaded SWF's library) and create lots of new instances of that
  symbol - that is perfectly normal and works fine.
 
  or
 
  ii) Actually load multiple instances of the SWF. This isn't anything
  like as heavyweight/slow as you might expect (and was the way to do it
  in AS2) as the SWF will be in the browser's cache.
 
  HTH,
Ian
 
  On Fri, Apr 3, 2009 at 12:49 PM, Henry Cooke
  aninfinitenumberofmonk...@gmail.com wrote:
   hej folks,
   I'm writing an assetloader class, with the intention of attaching a
 whole
   bunch of instances to the stage of a loaded asset. Because I want to
  attach
   more than one instance of the loaded SWF, I'm having to duplicate the
  asset
   instead of just using addChild, because you can only addChild one
  instance
   of an object to the stage at a time.
  
   So, I've written the following function in a class which extends
 Loader:
  
   public function get asset():DisplayObject{
  
   var cn:String = getQualifiedClassName( contentLoaderInfo.content );
  
   var c:Class = Class( contentLoaderInfo.applicationDomain.getDefinition(
  cn )
   );
  
   return( DisplayObject( new c() ) );
  
   //return( contentLoaderInfo.content );
  
   }
  
   However, when I try to use the duplicated asset, I can't control its
   timeline, and any sound on that timeline is heard whether it's attached
  to
   the stage or not. Basically, I suspect that duplicating the asset is
   mangling its timeline somehow. Uncommenting the commented return and
   commenting everything else out gives me a movieclip that behaves how I
   expect, but of course can only be attached to the stage once.
  
   Has anyone tried stuff like this before (duplicating a loaded SWF with
   timeline intact)?
  
   h.
   ___
   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

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


Re: [Flashcoders] id3 runtime error

2009-04-03 Thread Dave Segal
This is the error I am seeing. Strangely the part after the word access is 
left blank. Which leads me to believe it is some kind of timing bug on my side 
however, the trigger for this function is the ID3 event. I also tried waiting 
for the COMPLETE event but the same issue occurs. As I mentioned the mp3 file 
is on the same server so I'm not sure why it would be looking for a policy file 
at all. The files are in different directories however if that gives some clue.

SecurityError: Error #2122: Security sandbox violation: Sound.id3: 
http://content.dev.com/char/engines/engine.swf cannot access . A policy file is 
required, but the checkPolicyFile flag was not set when this media was loaded.

Thanks for your help.


- Original Message -
From: Taka Kojima t...@gigafied.com
To: Flash Coders List flashcoders@chattyfig.figleaf.com
Sent: Thursday, April 2, 2009 8:08:05 PM GMT -05:00 US/Canada Eastern
Subject: Re: [Flashcoders] id3 runtime error

Hey Dave,

Can you paste the exact error message?

On Thu, Apr 2, 2009 at 4:51 PM, Dave Segal d...@oddcast.com wrote:
 I have a bug that is driving me nuts. I am loading an mp3 file from the
 same server as my swf. About 1 in 30 tries when trying to reading the id3
 tags after the ID3 event I get a runtime error telling me I need to load
 the crossdomain policy file in order to access the tags. I tried setting
 the checkpolicyfile flag to true and placing a valid crossdomain.xml on
 the server but the error occurs with the same frequency.

 ___
 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] id3 runtime error

2009-04-03 Thread Dave Segal
Joel,
I am not sure of the ID3 version. Does that matter? Would different versions of 
the ID3 tags cause this type of inconsistent failure?
Dave

- Original Message -
From: Joel Stransky stranskydes...@gmail.com
To: Flash Coders List flashcoders@chattyfig.figleaf.com
Sent: Friday, April 3, 2009 12:01:11 AM GMT -05:00 US/Canada Eastern
Subject: Re: [Flashcoders] id3 runtime error

Are they id3 version 1 or 2?

--Joel

On Apr 2, 2009, at 7:51 PM, Dave Segal d...@oddcast.com wrote:

 I have a bug that is driving me nuts. I am loading an mp3 file from  
 the
 same server as my swf. About 1 in 30 tries when trying to reading  
 the id3
 tags after the ID3 event I get a runtime error telling me I need to  
 load
 the crossdomain policy file in order to access the tags. I tried  
 setting
 the checkpolicyfile flag to true and placing a valid crossdomain.xml  
 on
 the server but the error occurs with the same frequency.

 ___
 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] Flashplayer positioning

2009-04-03 Thread Glen Pike

Hi,

   This was an issue with the Flashplayer running without a Window 
manager - for some reason FP10 defaulted to a 200x200 pixel sized window 
and ignored the size of the Flash content when run in fullscreen.


   The only way around this is to run a desktop / window manager and 
launch Flashplayer inside that - problematic because if Flash dies / 
exits, the user gets access to the desktop rather than a blank screen  - 
not good for kiosk apps.


   Funny thing is, Flashplayer 9 is fine, so have submitted a bug 
because that's an unexpected change of behaviour that we have no way of 
working around..


   Thanks for your help, maybe this will be useful for anyone with 
similar problems


   Glen


Glen Pike wrote:

Hi,

   I tried the Stage.align but this has no effect.

   The stage size is the same as the monitor size.

   Looking into this further, it seems to be an issue with the Window 
Manager - if we run X11 with no Window Manager and start Flashplayer 
from the command line it can't seem to position itself properly.  If 
we run Flash with a Window Manager / Desktop, e.g. xfce, it aligns 
fine.  I am guessing something changed in FP10 relating to X11 but 
what...


   Glen

Taka Kojima wrote:

not sure, maybe FP10 defaults to a different stage alignment. Maybe
try explicity stating the stage alignment and see if that fixes it.

- Taka

On Thu, Apr 2, 2009 at 11:16 AM, Glen Pike 
postmas...@glenpike.co.uk wrote:
 

Hi,

  There is stuff offstage, but I am not sure if it is in a guide 
layer or

not - will check later.

  Why this would happen in FP10 and not 9 though??

  Glen

Joel Stransky wrote:
   

Is there any off-stage content that might be causing this?

On Thu, Apr 2, 2009 at 12:42 PM, Glen Pike
g...@engineeredarts.co.ukwrote:


 

Hi,

 I have just setup FP10 in standalone on my Gentoo Linux box and am
running a SWF from the command line in standalone mode.

 The x, y position of my SWF is all wrong - the SWF is positioned 
mostly

off the screen.  Reverting to FP9 standalone it works fine.

 The SWF is compiled for AS2.

 Does anyone have any ideas about this??
   Ta

 Glen
___
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 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


Re: [Flashcoders] id3 runtime error

2009-04-03 Thread Taka Kojima
Do you have firebug?

Is it possible that it's using the wrong path or even trying to
request  when it makes the call? If you have firebug, you can look
at all of the http requests through the net panel.

If you're using a variable to make the load call, try hardcoding a
value and see if that solves the issue...

Although, I'm not sure if Flash is throwing the security error if it
will even show up.

Can you paste the code that does the loading and event handling?

- Taka

On Fri, Apr 3, 2009 at 10:49 AM, Dave Segal d...@oddcast.com wrote:
 This is the error I am seeing. Strangely the part after the word access is 
 left blank. Which leads me to believe it is some kind of timing bug on my 
 side however, the trigger for this function is the ID3 event. I also tried 
 waiting for the COMPLETE event but the same issue occurs. As I mentioned the 
 mp3 file is on the same server so I'm not sure why it would be looking for a 
 policy file at all. The files are in different directories however if that 
 gives some clue.

 SecurityError: Error #2122: Security sandbox violation: Sound.id3: 
 http://content.dev.com/char/engines/engine.swf cannot access . A policy file 
 is required, but the checkPolicyFile flag was not set when this media was 
 loaded.

 Thanks for your help.


 - Original Message -
 From: Taka Kojima t...@gigafied.com
 To: Flash Coders List flashcoders@chattyfig.figleaf.com
 Sent: Thursday, April 2, 2009 8:08:05 PM GMT -05:00 US/Canada Eastern
 Subject: Re: [Flashcoders] id3 runtime error

 Hey Dave,

 Can you paste the exact error message?

 On Thu, Apr 2, 2009 at 4:51 PM, Dave Segal d...@oddcast.com wrote:
 I have a bug that is driving me nuts. I am loading an mp3 file from the
 same server as my swf. About 1 in 30 tries when trying to reading the id3
 tags after the ID3 event I get a runtime error telling me I need to load
 the crossdomain policy file in order to access the tags. I tried setting
 the checkpolicyfile flag to true and placing a valid crossdomain.xml on
 the server but the error occurs with the same frequency.

 ___
 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


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


Re: [Flashcoders] Flashplayer positioning

2009-04-03 Thread Taka Kojima
Glad you figured it out Glen and thanks for the solution/workaround.

On Fri, Apr 3, 2009 at 11:07 AM, Glen Pike postmas...@glenpike.co.uk wrote:
 Hi,

   This was an issue with the Flashplayer running without a Window manager -
 for some reason FP10 defaulted to a 200x200 pixel sized window and ignored
 the size of the Flash content when run in fullscreen.

   The only way around this is to run a desktop / window manager and launch
 Flashplayer inside that - problematic because if Flash dies / exits, the
 user gets access to the desktop rather than a blank screen  - not good for
 kiosk apps.

   Funny thing is, Flashplayer 9 is fine, so have submitted a bug because
 that's an unexpected change of behaviour that we have no way of working
 around..

   Thanks for your help, maybe this will be useful for anyone with similar
 problems

   Glen


 Glen Pike wrote:

 Hi,

   I tried the Stage.align but this has no effect.

   The stage size is the same as the monitor size.

   Looking into this further, it seems to be an issue with the Window
 Manager - if we run X11 with no Window Manager and start Flashplayer from
 the command line it can't seem to position itself properly.  If we run Flash
 with a Window Manager / Desktop, e.g. xfce, it aligns fine.  I am guessing
 something changed in FP10 relating to X11 but what...

   Glen

 Taka Kojima wrote:

 not sure, maybe FP10 defaults to a different stage alignment. Maybe
 try explicity stating the stage alignment and see if that fixes it.

 - Taka

 On Thu, Apr 2, 2009 at 11:16 AM, Glen Pike postmas...@glenpike.co.uk
 wrote:


 Hi,

  There is stuff offstage, but I am not sure if it is in a guide layer or
 not - will check later.

  Why this would happen in FP10 and not 9 though??

  Glen

 Joel Stransky wrote:


 Is there any off-stage content that might be causing this?

 On Thu, Apr 2, 2009 at 12:42 PM, Glen Pike
 g...@engineeredarts.co.ukwrote:




 Hi,

  I have just setup FP10 in standalone on my Gentoo Linux box and am
 running a SWF from the command line in standalone mode.

  The x, y position of my SWF is all wrong - the SWF is positioned
 mostly
 off the screen.  Reverting to FP9 standalone it works fine.

  The SWF is compiled for AS2.

  Does anyone have any ideas about this??
   Ta

  Glen
 ___
 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 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


Re: [Flashcoders] id3 runtime error

2009-04-03 Thread Dave Segal
I see the request in the headers and when I debug with Flex, the variables all 
appear to be declared correctly. I tried hardcoding the url as well but I get 
the same issue. I'm stumped. I suppose I can just catch the error and try to 
reload the mp3 file though that is a very unsatisfying solution.

I'll see if I can create a simple example of the issue and post to the forum.

Thanks for you helping Taka.


- Original Message -
From: Taka Kojima t...@gigafied.com
To: Flash Coders List flashcoders@chattyfig.figleaf.com
Sent: Friday, April 3, 2009 2:07:54 PM GMT -05:00 US/Canada Eastern
Subject: Re: [Flashcoders] id3 runtime error

Do you have firebug?

Is it possible that it's using the wrong path or even trying to
request  when it makes the call? If you have firebug, you can look
at all of the http requests through the net panel.

If you're using a variable to make the load call, try hardcoding a
value and see if that solves the issue...

Although, I'm not sure if Flash is throwing the security error if it
will even show up.

Can you paste the code that does the loading and event handling?

- Taka

On Fri, Apr 3, 2009 at 10:49 AM, Dave Segal d...@oddcast.com wrote:
 This is the error I am seeing. Strangely the part after the word access is 
 left blank. Which leads me to believe it is some kind of timing bug on my 
 side however, the trigger for this function is the ID3 event. I also tried 
 waiting for the COMPLETE event but the same issue occurs. As I mentioned the 
 mp3 file is on the same server so I'm not sure why it would be looking for a 
 policy file at all. The files are in different directories however if that 
 gives some clue.

 SecurityError: Error #2122: Security sandbox violation: Sound.id3: 
 http://content.dev.com/char/engines/engine.swf cannot access . A policy file 
 is required, but the checkPolicyFile flag was not set when this media was 
 loaded.

 Thanks for your help.


 - Original Message -
 From: Taka Kojima t...@gigafied.com
 To: Flash Coders List flashcoders@chattyfig.figleaf.com
 Sent: Thursday, April 2, 2009 8:08:05 PM GMT -05:00 US/Canada Eastern
 Subject: Re: [Flashcoders] id3 runtime error

 Hey Dave,

 Can you paste the exact error message?

 On Thu, Apr 2, 2009 at 4:51 PM, Dave Segal d...@oddcast.com wrote:
 I have a bug that is driving me nuts. I am loading an mp3 file from the
 same server as my swf. About 1 in 30 tries when trying to reading the id3
 tags after the ID3 event I get a runtime error telling me I need to load
 the crossdomain policy file in order to access the tags. I tried setting
 the checkpolicyfile flag to true and placing a valid crossdomain.xml on
 the server but the error occurs with the same frequency.

 ___
 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


___
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] XML loading. Why file is cached, but script response is not?

2009-04-03 Thread Pavel Repkin
Hey!
My program loads XML data from the server.
I want the data to cache, so the loading happens only once.
When I load a simple xml file from the server, the caching works like a
charm.

But when I load xml from a Perl script response, the cache does not work.
The data are being loaded every time I call XML.load(...)
The request URL is simple and does not change over time: 
http://repkasoft.com/cgi-bin/test/responseCache/provider.pl;


Do you know why caching does not work for script response?
Is it possible to make it work?
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders