Re: [Flashcoders] problem creating multiple instances

2007-05-23 Thread Bill Mackin
After reading your first e-mail I did go through and make a change  
here, but it did not resolve the issue.
_mcLibrary = _scope.attachMovie(libraryLink, mcLibrary+myName,  
_scope.getNextHighestDepth());


The line you mention is not the MovieClip reference for the plane,  
but a MovieClip created to create a BitmapData object.
_bd = new BitmapData(_mcLibrary._width, _mcLibrary._height, true,  
0x00);


This BitmapData object is later placed into the plane reference  
MovieClip.  At least that is my understanding... YIKES!

_di = new DistortImage(_mc, _bd, vQuality, hQuality);

I'm not able to post the class inside the e-mail anymore, it exceeds  
the maximum file size allowed by flashcoders.  If you need the class  
file again I will create a link to all of the files.


Thanks for your response!


On May 23, 2007, at 4:03 PM, David Ngo wrote:

Yeah, you're using the same MovieClip name reference. I do believe  
you can't
have two objects share the same name. You'll get concurrency issues  
with

that on this line:

_mcLibrary = _scope.attachMovie(libraryLink,mcLibrary,
_scope.getNextHighestDepth());


You'll need to create a unique ID for it. I would probably suggest  
either
within your creation object, or have an ID factory (should probably  
be a

hybrid Singleton/Factory) that just generates unique ID's that you can
append to your instance names.

As for the custom class, it's nothing more than a blank class with  
public
variables (or private ones and getter/setter methods) that contain  
the data
you want to pass. OR, since you use two separate objects, just have  
a single
object compose both. There are many ways to go about doing it, so  
it just

boils down to preference I guess.


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] problem creating multiple instances

2007-05-23 Thread Bill Mackin
Yes it is.  It is the name the person designates to the plane at  
runtime.


On May 23, 2007, at 9:58 PM, David Ngo wrote:


Where are you getting 'myName'? Is that a unique name per instance?


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of  
Bill Mackin

Sent: Wednesday, May 23, 2007 6:33 AM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] problem creating multiple instances

After reading your first e-mail I did go through and make a change
here, but it did not resolve the issue.
_mcLibrary = _scope.attachMovie(libraryLink, mcLibrary+myName,
_scope.getNextHighestDepth());

The line you mention is not the MovieClip reference for the plane,
but a MovieClip created to create a BitmapData object.
_bd = new BitmapData(_mcLibrary._width, _mcLibrary._height, true,
0x00);

This BitmapData object is later placed into the plane reference
MovieClip.  At least that is my understanding... YIKES!
_di = new DistortImage(_mc, _bd, vQuality, hQuality);

I'm not able to post the class inside the e-mail anymore, it exceeds
the maximum file size allowed by flashcoders.  If you need the class
file again I will create a link to all of the files.

Thanks for your response!


On May 23, 2007, at 4:03 PM, David Ngo wrote:


Yeah, you're using the same MovieClip name reference. I do believe
you can't
have two objects share the same name. You'll get concurrency issues
with
that on this line:

_mcLibrary = _scope.attachMovie(libraryLink,mcLibrary,
_scope.getNextHighestDepth());


You'll need to create a unique ID for it. I would probably suggest
either
within your creation object, or have an ID factory (should probably
be a
hybrid Singleton/Factory) that just generates unique ID's that you  
can

append to your instance names.

As for the custom class, it's nothing more than a blank class with
public
variables (or private ones and getter/setter methods) that contain
the data
you want to pass. OR, since you use two separate objects, just have
a single
object compose both. There are many ways to go about doing it, so
it just
boils down to preference I guess.


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] problem creating multiple instances

2007-05-23 Thread Bill Mackin

Muzak,

Thanks for your suggestion, I will look into XRay for future projects.

I have of course placed several trace commands throughout my code,  
but I am still unable to find the problem.


Cheers,

- Bill


On May 23, 2007, at 9:46 PM, Muzak wrote:

I suggest you start placing some trace()'s in your code so you can  
track what happens.


And get XRay..
http://osflash.org/xray

regards,
Muzak


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Detect Flash version in AS3

2007-05-23 Thread Bill Mackin

Joe,

In my experience, using some kind of javascript like SWFObject or UFO  
is the best way to go.  There is a project named SWFFix that looks  
promising, but it appears that no work has been done on it since Feb.


http://www.swffix.org/devblog/

As for using AS3 to detect for the version of flash, you are correct  
to assume that older versions of the Flash player will have problems.


Cheers,

- Bill


On May 24, 2007, at 12:48 AM, Joe Cutting wrote:


Hello,
  I'm building a web project in AS3 using Flash CS3. Originally my  
idea was
that the swf would do a version check at the start of the program  
and if the user wasn't running

Flash 9 they would be redirected to download the upgrade.
Now, I've done some thinking about this and realised that if the  
user isn't running Flash 9 then they
won't be able to run the swf at all so it wouldn't be able to run  
the version check.
Can anyone confirm that this is the case? If so it looks like that  
the only ways to check if

users can run AS3 swfs are:
- use some kind of javascript like SWF Object
- use another version detection swf written in AS2. My  
understanding is that this would have to call the

AS3 swf rather than wrapping it.

I'd be interested to know how other people have got on with this  
issue.


Cheers

Joe



Joe Cutting
Computer exhibits and installations
www.joecutting.com
The Fishergate Centre, 4 Fishergate, York, YO10 4FB
01904 624681

As of 30th October 2006 I have a new office so
please note my new address and phone number   
___

Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Q:Create and animate diagonal slices from Bitmap

2007-05-23 Thread Bill Mackin

Jesse,

Pretty cool!

H... Would be great if the you were able to add filters to the  
image below just within the bounds of that slice.


Cheers,

- Bill



On May 24, 2007, at 12:15 AM, Jesse Graupmann wrote:


Stage.scaleMode = 'noScale'
import flash.display.*
import flash.geom.*


function drawSlices ( image:MovieClip, drawMC:MovieClip,  
rotation:Number,

sliceWidth:Number )
{
var slice_info = getSliceInfo ( image, rotation );

// DOT IS JUST A VISUAL MARKER
dot._x = image._x + slice_info.pt.x;
dot._y = image._y + slice_info.pt.y;
dot.swapDepths ( dot._parent.getNextHighestDepth() )

var angle = rotation * (Math.PI/180);

var slices_top = Math.ceil(image._width/sliceWidth);
var slices_bottom = Math.ceil((slice_info.pt.x)/sliceWidth)

var slice_array = [];
for ( var i = -slices_bottom; i  slices_top; i++ )
{
var slice = drawMC.createEmptyMovieClip ( 'slice_' + i,
drawMC.getNextHighestDepth() );
slice._x = i * ( sliceWidth-(sliceWidth/1.7));

var bmp_temp = new BitmapData ( sliceWidth+1,
slice_info.diagonal_height+sliceWidth, true, 0x00FF );
var bmp_temp_matrix:Matrix = new Matrix();
bmp_temp_matrix.rotate( angle );

bmp_temp_matrix.translate( -(sliceWidth) * i, -sliceWidth *
i );
bmp_temp.draw ( image, bmp_temp_matrix, null, null, null,
true );

var slice_bmp = new BitmapData ( slice_info.diagonal_width ,
slice_info.diagonal_height, true, 0x00FF );
var slice_bmp_matrix:Matrix = new Matrix();
slice_bmp_matrix.rotate(-angle);
slice_bmp_matrix.translate( (sliceWidth )*i, 0 );

slice_bmp.draw ( bmp_temp, slice_bmp_matrix, null,
null,null, true  );
slice.attachBitmap ( slice_bmp, 1, true, true );

slice_array.push ( slice );
}
drawMC.slice_array = slice_array;
}




function getSliceInfo ( image, angle)
{
var pt = new Point ( image._width, image._height );
var len = pt.length;

var degrees = 90 - angle;
var radians = degrees * (Math.PI/180);  

var dpt = new Point ( len * Math.cos ( radians ), len * Math.sin (
radians ) );

dpt.x = Math.max ( 0, Math.min ( pt.x, dpt.x ));
dpt.y = Math.max ( 0, Math.min ( pt.y, dpt.y ));

var info = {
pt:dpt,
diagonal_width: dpt.x,
diagonal_height: dpt.length
}
return info;
}




function drawSlicedImage ()
{   
// ORIGINAL IMAGE
mc._alpha = 40

//  SLICE HOLDER
var drawMC = this.createEmptyMovieClip ( 'drawMC',
this.getNextHighestDepth() );
drawMC._x = mc._x;
drawMC._y = mc._y;

//  CREATE SLICES
var sliceWidth = 30
var angle = 45;
drawSlices ( mc, drawMC, angle, sliceWidth );
}

function addSliceInteraction ( )
{
drawMC.onMouseMove = function()
{
var xper = Math.max ( 0, Math.min ( 1, this._xmouse /
mc._width ) )
var yper = 1-Math.max ( 0, Math.min ( 1, this._ymouse /
mc._height ) )
var per = (xper+yper)/2
var inx = Math.round ( this.slice_array.length * per  )
for ( var i in this.slice_array  )
{
var slice = this.slice_array [ i ];
if ( i == inx )
{
slice._alpha = 10;
}
else
{
slice._alpha = 100;
}
}
}
}


//


function INIT ()
{
drawSlicedImage ();
addSliceInteraction ();
}

INIT ();


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] problem creating multiple instances

2007-05-23 Thread Bill Mackin

Finally found the problem!!

In the end it was very simple.  I did not define  
_myMouseListener:Object in the correct place, and it was being  
overwritten.


Thanks for the help!

Cheers,

- Bill


On May 24, 2007, at 6:41 AM, Bill Mackin wrote:

Yes it is.  It is the name the person designates to the plane at  
runtime.


On May 23, 2007, at 9:58 PM, David Ngo wrote:


Where are you getting 'myName'? Is that a unique name per instance?


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of  
Bill Mackin

Sent: Wednesday, May 23, 2007 6:33 AM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] problem creating multiple instances

After reading your first e-mail I did go through and make a change
here, but it did not resolve the issue.
_mcLibrary = _scope.attachMovie(libraryLink, mcLibrary+myName,
_scope.getNextHighestDepth());

The line you mention is not the MovieClip reference for the plane,
but a MovieClip created to create a BitmapData object.
_bd = new BitmapData(_mcLibrary._width, _mcLibrary._height, true,
0x00);

This BitmapData object is later placed into the plane reference
MovieClip.  At least that is my understanding... YIKES!
_di = new DistortImage(_mc, _bd, vQuality, hQuality);

I'm not able to post the class inside the e-mail anymore, it exceeds
the maximum file size allowed by flashcoders.  If you need the class
file again I will create a link to all of the files.

Thanks for your response!


On May 23, 2007, at 4:03 PM, David Ngo wrote:


Yeah, you're using the same MovieClip name reference. I do believe
you can't
have two objects share the same name. You'll get concurrency issues
with
that on this line:

_mcLibrary = _scope.attachMovie(libraryLink,mcLibrary,
_scope.getNextHighestDepth());


You'll need to create a unique ID for it. I would probably suggest
either
within your creation object, or have an ID factory (should probably
be a
hybrid Singleton/Factory) that just generates unique ID's that  
you can

append to your instance names.

As for the custom class, it's nothing more than a blank class with
public
variables (or private ones and getter/setter methods) that contain
the data
you want to pass. OR, since you use two separate objects, just have
a single
object compose both. There are many ways to go about doing it, so
it just
boils down to preference I guess.


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


[Flashcoders] problem creating multiple instances

2007-05-22 Thread Bill Mackin

Hello,

I'm having a problem with one of my class files.  I've created a  
class to control the animation of a 3D plane, but I am unable to use  
multiple instances at the same time.  I'm not sure what it is that is  
conflicting.  Any ideas would be appreciated.


I've attached the class file.  If the other class files are needed,  
please let me know.  I also have a test FLA that I have been using to  
test my progress on this problem.


Cheers,

- Bill
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Re: [Flashcoders] problem creating multiple instances

2007-05-22 Thread Bill Mackin

Hello,

Looks like the attachment did not go out.  I've pasted the  
Actionscript into this e-mail.


Cheers,

- Bill

/*  
Simple 3D Plane - v1.0


Created : January 24, 2007
Last Updated : May 18, 2007

Copyright © 2007 Pixlart.  All rights reserved.

http://www.pixlart.net
info [at] pixlart [dot] net
*/


/// \\ 
\

/*
	DESCRIPTION		Allows you to animate MovieClips and Bitmaps on a 3D  
plane with full control and easing.



AUTHOR(s)   Bill Mackin - http://www.billmackin.com
Combination of 
scripts and development of 3D animation API.

•	Marquee Flipper - Which provided a good starting point and  
combination of World3d and DistortImage.

Felix 
Turner - http://www.airtightinteractive.com
•   Simple 3d Engine 
World3d - A very basic light 3D engine.
André 
Michelle - http://www.andre-michelle.com
•	DistortImage - A class to distort an image (including  
persective distortions) by slicing the image into smaller pieces  
(generally triangles).
	Thomas Pfeiffer kiroukou - http://www.thomas- 
pfeiffer.info

Richard Lester 
RichL
Didier Brun 
foxy - http://www.foxaweb.com
•	Easing Equations - Popular equations used by many to  
provide easing effects in scripted animations.

Robert 
Penner - http://www.robertpenner.com

	  


USAGE
	  


var myCreationSettings:Object = {
myName:3DCircleOnCavill,
libraryLink:CircleOnCavill,
scope:this,
xAxisStart:0,
yAxisStart:0,
mouseReactive:false,
vQuality:3,
hQuality:3
}
var my3Dplane:Simple3DPlane = new Simple3DPlane(myCreationSettings);

var myAnimationSettings:Object = {
xAxisTo:0,
yAxisTo:180,
animationDuration:1,
easingMath:Expo,
easingType:easeOut,
delay:1,
callBack:doSomething,
callBackScope:this,
callBackArgs:[true, both, 1]
}
my3Dplane.animate3DPlane(myAnimationSettings);

	my3Dplane.getTarget();	// returns an instance of the newly created  
MovieClip containing the 3D plane.


	my3Dplane.mouseReactive(true, 30, 20, true);		@param1 = turns 3D  
movement based on mouse position on/off
			@param2 = the limit for the 3D movement on the x  
axis, (in degrees).
			@param3 = the limit for the 3D movement on the y  
axis, (in degrees).
			@param4 = determines whether the 3D plane rotates  
towards the mouse or away, (only used when limiting angles).
	  


NOTES
	  



BILL MACKIN
	•	When using a MovieClip for your content, be sure to position the  
top left of your content at 0,0.


TO DO
	1.	Update so you can create several 3D plane instances and control  
each of them separately.

*/
/// \\ 
\



///
// INCLUDE / IMPORT ---
// 
import flash.display.BitmapData;
import flash.geom.Matrix;
import mx.utils.Delegate;
import ActionScript.simple3D.DistortImage
import ActionScript.simple3D.World3d
import ActionScript.Tools.PennerEasing
 
//





class ActionScript.simple3D.Simple3DPlane {

	// PROPERTIES //  


var myName:String

Re: [Flashcoders] problem creating multiple instances

2007-05-22 Thread Bill Mackin
This is how I am instantiating the creationObject (below).  I believe  
that if I am passing a different name to the myName property it  
should create more than one MovieClip instance.


I'd love to hear more about your suggestion to use a custom class to  
set properties instead of a generic object, or maybe point me in the  
direction of good tutorial or example.  Unfortunately I am a self  
taught coder and am not always familiar with some of the best practices.


var myCreationSettings:Object = {
myName:3DCircleOnCavill,
libraryLink:CircleOnCavill,
scope:this,
xAxisStart:-20,
yAxisStart:20,
vQuality:3,
hQuality:3
}
var my3Dplane:Simple3DPlane = new Simple3DPlane(myCreationSettings);
my3Dplane.mouseReactive(true, 30, 20, true);

var myCreationSettings2:Object = {
myName:3DCircleOnCavill2,
libraryLink:tom,
scope:this,
xAxisStart:-20,
yAxisStart:20,
vQuality:3,
hQuality:3
}
var my3Dplane2:Simple3DPlane = new Simple3DPlane(myCreationSettings2);
my3Dplane2.mouseReactive(true, 30, 20, true);

On May 23, 2007, at 3:20 PM, David Ngo wrote:

Looks like you're attaching your plane to the same MovieClip  
instance, thus
destroying any/all objects that was previously on that MovieClip  
instance.
Depends on how you're instantiating your creationObject. BTW, just  
a comment
on your implementation: I would use a custom class to set  
properties for
creation and animation rather than a generic object. This way, you  
can avoid
having to iterate through the object and then you can just  
composition your
custom class/object. In Java, this would be equivalent to a Value  
Object or

a Data Transfer Object.



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of  
Bill Mackin

Sent: Wednesday, May 23, 2007 12:51 AM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] problem creating multiple instances

Hello,

Looks like the attachment did not go out.  I've pasted the
Actionscript into this e-mail.

Cheers,

- Bill

/*  
Simple 3D Plane - v1.0


Created : January 24, 2007
Last Updated : May 18, 2007

Copyright © 2007 Pixlart.  All rights reserved.

http://www.pixlart.net
info [at] pixlart [dot] net
*/


/// \\
\
/*
DESCRIPTION Allows you to animate MovieClips and Bitmaps
on a 3D
plane with full control and easing.


AUTHOR(s)   Bill Mackin -
http://www.billmackin.com
Combination
of scripts and development of 3D animation API.

•
Marquee Flipper - Which provided a good starting point and
combination of World3d and DistortImage.

Felix Turner - http://www.airtightinteractive.com
•
Simple 3d Engine World3d - A very basic light 3D engine.

André Michelle - http://www.andre-michelle.com
•
DistortImage - A class to distort an image (including
persective distortions) by slicing the image into smaller pieces
(generally triangles).

Thomas Pfeiffer kiroukou - http://www.thomas-
pfeiffer.info

Richard Lester RichL

Didier Brun foxy - http://www.foxaweb.com
•
Easing Equations - Popular equations used by many to
provide easing effects in scripted animations.

Robert Penner - http://www.robertpenner.com



USAGE


var myCreationSettings:Object = {
myName:3DCircleOnCavill,
libraryLink:CircleOnCavill,
scope:this,
xAxisStart:0,
yAxisStart:0,
mouseReactive:false,
vQuality:3,
hQuality:3
}
var my3Dplane:Simple3DPlane = new Simple3DPlane(myCreationSettings);

var myAnimationSettings:Object = {
xAxisTo:0