[Flashcoders] Re: Weird Behavior of hitTestPoint and removeChild()

2008-03-05 Thread anuj sharma
I am sorry my center formula should be "((regcRCx+regcRCWidth/2),
>
> (regcRCy+regcRCHeight/2)", but with this formula also my code is giving
> inconsisten results. It seems like ti is keeping something in the memory and
> showing deletion stage of



> instance somewhere where I did not intend  to.

Thanks



On Wed, Mar 5, 2008 at 3:02 PM, anuj sharma <[EMAIL PROTECTED]> wrote:

> Hi
> I am trying to drag and drop multiple instances of UILoader on stage. My
> goal is if user puts UILaoder partially on top of other UILoader , it should
> just stay on top of it. If user puts on top of UILoader more than the
> central point of other UILoader, the other UILoader will change the color of
> its border and on mouse release gets replaced by the placed UILoader.
> I am successful in getting all this but I am getting inconsistent results
> as an output. Sometimes I have to put exactly on top of other UILoader to
> replace it and sometimes I just touch the UILoader and it shows red border
> and gets replaced. I used the logic of calculating the center of
> rectangle(my UILoader container) and use hitPoint method, and as soon as
> dragged UILoader hits the calculated center of UILoader, it gets replaced.
> Please help me out in where I am messing things up.Any better idea than
> this will also be highly appreciated.
> ( Following is the function which is telling my UILoader to replace of
> stopDrag.)
> Thanks a lot
> Anuj
> /*CODE***/
> function dropUILoader(e:MouseEvent):void
> {
>
> if(e.targetis UILoader)
> {
> var myUILoader:UILoader = e.target as UILoader;
>
> if (mouseY<746)
> {
> myUILoader.stopDrag();
> //Putting video on top of already existed videos
> var trackChild:Number=container.getChildIndex(myUILoader);
> var childContainer:DisplayObject= container.getChildAt
> (trackChild);
> for (var z:Number=0; z<=container.numChildren-1; z++)
> {
> var restChild:DisplayObject=container.getChildAt(z);
>
> if (childContainer!=restChild)
> {
> if(restChild is UILoader)
> {
> var cRC:UILoader=restChild as UILoader;
>
> var regcRCx:Number=cRC.x;
> var regcRCy:Number=cRC.y;
>
> var regcRCWidth:Number=cRC.width;
> var regcRCHeight:Number=cRC.height;
>
> 
> if(childContainer.hitTestPoint(((regcRCx+regcRCWidth)/2),(regcRCy+regcRCHeight)/2)==true)
>
> {
> trace("Totally Hit");
> container.removeChild(cRC);
> }
> else
> {
> trace("Partially Hit");
> }
> }
> }
> }
> }
> else
> {
> myUILoader.unload();
> container.removeChild(myUILoader);
> }
> }
> }
>
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] Weird Behavior of hitTestPoint and removeChild()

2008-03-05 Thread anuj sharma
Hi
I am trying to drag and drop multiple instances of UILoader on stage. My
goal is if user puts UILaoder partially on top of other UILoader , it should
just stay on top of it. If user puts on top of UILoader more than the
central point of other UILoader, the other UILoader will change the color of
its border and on mouse release gets replaced by the placed UILoader.
I am successful in getting all this but I am getting inconsistent results as
an output. Sometimes I have to put exactly on top of other UILoader to
replace it and sometimes I just touch the UILoader and it shows red border
and gets replaced. I used the logic of calculating the center of
rectangle(my UILoader container) and use hitPoint method, and as soon as
dragged UILoader hits the calculated center of UILoader, it gets replaced.
Please help me out in where I am messing things up.Any better idea than this
will also be highly appreciated.
( Following is the function which is telling my UILoader to replace of
stopDrag.)
Thanks a lot
Anuj
/*CODE***/
function dropUILoader(e:MouseEvent):void
{

if(e.targetis UILoader)
{
var myUILoader:UILoader = e.target as UILoader;

if (mouseY<746)
{
myUILoader.stopDrag();
//Putting video on top of already existed videos
var trackChild:Number=container.getChildIndex(myUILoader);
var childContainer:DisplayObject= container.getChildAt
(trackChild);
for (var z:Number=0; z<=container.numChildren-1; z++)
{
var restChild:DisplayObject=container.getChildAt(z);

if (childContainer!=restChild)
{
if(restChild is UILoader)
{
var cRC:UILoader=restChild as UILoader;

var regcRCx:Number=cRC.x;
var regcRCy:Number=cRC.y;

var regcRCWidth:Number=cRC.width;
var regcRCHeight:Number=cRC.height;


if(childContainer.hitTestPoint(((regcRCx+regcRCWidth)/2),(regcRCy+regcRCHeight)/2)==true)

{
trace("Totally Hit");
container.removeChild(cRC);
}
else
{
trace("Partially Hit");
}
}
}
}
}
else
{
myUILoader.unload();
container.removeChild(myUILoader);
}
}
}
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Hit Object Question

2008-03-05 Thread anuj sharma
Thanks a lot
Its fixed now.
Appreciate it
Anuj

On Wed, Mar 5, 2008 at 2:32 AM, Kenneth Kawamoto <[EMAIL PROTECTED]>
wrote:

> Something like:
>
> private function greenTint(e:MouseEvent):void {
>var ctfm:ColorTransform = new ColorTransform();
>ctfm.color = 0x00ff00;
>e.target.transform.colorTransform = ctfm;
> }
>
> private function redTint(e:MouseEvent):void {
>var ctfm:ColorTransform = new ColorTransform();
>ctfm.color = 0xff;
>e.target.transform.colorTransform = ctfm;
> }
>
> Kenneth Kawamoto
> http://www.materiaprima.co.uk/
>
> anuj sharma wrote:
> > How do I change the color of one sprite. I am sorry but I am little
> > unclear of how does it work both toggling or change Sprite color. I am
> > little new to this language .
> > Please help me out
> > Thanks
> > Anuj
> >
> > On Tue, Mar 4, 2008 at 1:29 PM, Kenneth Kawamoto
> > <[EMAIL PROTECTED] > wrote:
> >
> > To make your approach work, you can draw a rectangle in ldrBdr and
> > bdrRep (one in red and one in green) and toggle the alpha of one of
> them
> > sits above the other (if you addChild() it goes above everything
> already
> > in the display list).
> >
> > Or just change the colour of one border Sprite instead.
> >
> > Kenneth Kawamoto
> > http://www.materiaprima.co.uk/
> >
> > anuj sharma wrote:
> >  > Hi Kenneth
> >  > Thanks for the reply. So what's the solution of my problem?
> >  > Thanks
> >  > Anuj
> >  >
> >  > On Tue, Mar 4, 2008 at 1:01 PM, Kenneth Kawamoto
> >  > <[EMAIL PROTECTED] 
> >  > >> wrote:
> >  >
> >  > I think it's a typo but your BdrRep has no rectangle drawn,
> > and even if
> >  > you did have the rectangle, toggling the alpha of Sprite
> > underneath will
> >  > not give you any visual feedbacks...
> >  >
> >  > Kenneth Kawamoto
> >  > http://www.materiaprima.co.uk/
> >  >
> >  > anuj sharma wrote:
> >  >  > Hi all
> >  >  > I am trying to implement hit object in my project. I have
> > sprite
> >  > class and I
> >  >  > am loading multiple instances of UI Loader in my sprite
> > class and
> >  > displaying
> >  >  > it on the main screen. The user can drag and drop those
> > UILoaders
> >  > on the
> >  >  > main stage wherever they want.My aim was that if user
> > drops one
> >  > UIloader on
> >  >  > top of already placed UiLoader, then the already placed
> > UILoader
> >  > will be
> >  >  > replaced with the dropped UILoader. I am successful in
> >  > implementing that by
> >  >  > hitting hitTestObject method. All of my UIloaders are
> having
> >  > green color
> >  >  > border. Now my requirement is that as soon as the user
> places
> >  > UILoader on
> >  >  > top of already existing UILoader , the  UILoader which is
> > going to be
> >  >  > replaced changes border color from green to red showing
> > the user
> >  > that the
> >  >  > UIloader is being replaced and on Mouse release the
> > UiLoader is
> >  > going to be
> >  >  > replaced.
> >  >  > In short on mouse over, the border color has to be changed
> > and on
> >  > mouse
> >  >  > release, object has to be replaced. I am adding my
> > rectangle(in
> >  > Sprite
> >  >  > Container) as the border to the UILoader. Below is some
> > code to
> >  > make things
> >  >  > little clearer
> >  >  > Please help me in figuring out the problem.
> >  >  > Any help will be appreciated.
> >  >  > Thanks
> >  >  > Anuj
> >  >  > /*CODE
> >  >  > //UILoader Being Created
> >  >  > function
> CreateUILoaderObject(num:Number):DisplayObject
> >  >  > {
> >  >  > var myUILoader:UILoader = new UILoader();
> >  >  > var  container:Sprite=new Sprite();
> >  >  > myUILoader.name="myUILoader";
> >  >  > myUILoader.source = "/video/pic_"+(num+1)+".swf";
> >  >  > myUILoader.load();
> >  >  >
> >  >  > //Defining Border for the Selected Camera
> >  >  > var ldrBdr:Sprite = new Sprite();
> >  >  > ldrBdr.name = "border";
> >  >  > ldrBdr.alpha=0;
> >  >  > ldrBdr.graphics.lineStyle(2, 0x00ff00);
> >  >  > ldrBdr.graphics.drawRect(myUILoader.x+23,
> > myUILoader.y+45,
> >  >  > myUILoader.width, myUILoader.height);
> >  >  >
> >  >  > //Defining Border for the replaced Camera
> >  >  > var Bd

Re: [Flashcoders] wierd easter egg?

2008-03-05 Thread Allandt Bik-Elliott (Receptacle)

i'd love it to be the latter but it's all my flash

still - would be fun to do in the future...


On 5 Mar 2008, at 16:16, Andrew Sinning wrote:


Do you think this is an Adobe egg or a gsworld egg?

Allandt Bik-Elliott (Receptacle) wrote:

hey this is odd

i'm testing my movie at http://qsworld.co.uk/index.php? 
extcategory=Design&extdesigner=Darkest%20Star&extproduct=Jacket  
and when i tried right clicking the top right corner and selecting  
zoom in, i got linked to http://whatisthematrix.warnerbros.com/


i'm on osx 10.4, firefox 2.0.0.12

thought you might get a kick out of that

a

___
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] wierd easter egg?

2008-03-05 Thread Allandt Bik-Elliott (Receptacle)

especially as i wanted to zoom in lol xD


On 5 Mar 2008, at 15:22, Jon Bradley wrote:



On Mar 5, 2008, at 9:31 AM, Allandt Bik-Elliott (Receptacle) wrote:


hey this is odd

i'm testing my movie at http://qsworld.co.uk/index.php? 
extcategory=Design&extdesigner=Darkest%20Star&extproduct=Jacket  
and when i tried right clicking the top right corner and selecting  
zoom in, i got linked to http://whatisthematrix.warnerbros.com/


i'm on osx 10.4, firefox 2.0.0.12



Nice. That's a new one.

Firefox right-click zoom on OS X is screwed up with Flash Player.  
It does all sorts of weird crap on different machines.


For me, it always jumps to a hotkey to "bookmark" the current page.  
Pretty fricking annoying if you ask me.


- jb
___
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] wierd easter egg?

2008-03-05 Thread Andrew Sinning

Do you think this is an Adobe egg or a gsworld egg?

Allandt Bik-Elliott (Receptacle) wrote:

hey this is odd

i'm testing my movie at 
http://qsworld.co.uk/index.php?extcategory=Design&extdesigner=Darkest%20Star&extproduct=Jacket 
and when i tried right clicking the top right corner and selecting 
zoom in, i got linked to http://whatisthematrix.warnerbros.com/


i'm on osx 10.4, firefox 2.0.0.12

thought you might get a kick out of that

a

___
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] wierd easter egg?

2008-03-05 Thread Jon Bradley


On Mar 5, 2008, at 9:31 AM, Allandt Bik-Elliott (Receptacle) wrote:


hey this is odd

i'm testing my movie at http://qsworld.co.uk/index.php? 
extcategory=Design&extdesigner=Darkest%20Star&extproduct=Jacket and  
when i tried right clicking the top right corner and selecting zoom  
in, i got linked to http://whatisthematrix.warnerbros.com/


i'm on osx 10.4, firefox 2.0.0.12



Nice. That's a new one.

Firefox right-click zoom on OS X is screwed up with Flash Player. It  
does all sorts of weird crap on different machines.


For me, it always jumps to a hotkey to "bookmark" the current page.  
Pretty fricking annoying if you ask me.


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


Re: [Flashcoders] wierd easter egg?

2008-03-05 Thread Allandt Bik-Elliott (Receptacle)
wierd - it doesn't happen on my main screen (i'm using a monitor as  
the main screen with the laptop being my second screen)



On 5 Mar 2008, at 14:31, Allandt Bik-Elliott (Receptacle) wrote:


hey this is odd

i'm testing my movie at http://qsworld.co.uk/index.php? 
extcategory=Design&extdesigner=Darkest%20Star&extproduct=Jacket and  
when i tried right clicking the top right corner and selecting zoom  
in, i got linked to http://whatisthematrix.warnerbros.com/


i'm on osx 10.4, firefox 2.0.0.12

thought you might get a kick out of that

a

___
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] wierd easter egg?

2008-03-05 Thread Allandt Bik-Elliott (Receptacle)

hey this is odd

i'm testing my movie at http://qsworld.co.uk/index.php? 
extcategory=Design&extdesigner=Darkest%20Star&extproduct=Jacket and  
when i tried right clicking the top right corner and selecting zoom  
in, i got linked to http://whatisthematrix.warnerbros.com/


i'm on osx 10.4, firefox 2.0.0.12

thought you might get a kick out of that

a

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


Re: [Flashcoders] Lightweight Collision for Platform Game

2008-03-05 Thread Glen Pike

Grant Skinner has Proximity Manager which does something similar...

http://gskinner.com/blog/archives/2005/02/source_code_gri.html

Mark Winterhalder wrote:

On Tue, Mar 4, 2008 at 11:34 PM, Elia Morling <[EMAIL PROTECTED]> wrote:
  

What is the best collision system for a platform game? I've currently looked
 at box2D, but I think it runs amazingly slow on afew macs and other
 machines. Therefore I wonder if there is anything faster lightweight? I
 think I may need move towards a ray placed under the character instead of
 actually box-to-box collision. Any ideas?



The Flashplayer's native hitTest() is a fast bounding box test for two
specific clips, or pixel-exact test for a point and a clip. But if you
have several objects you need to test against each other, then
minimizing the total number of tests should come first. A quad tree
helps with that:



That should give you a small number of potential hits, which you can
then test with a more exact (and expensive) operation.

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


  


--

Glen Pike
01736 759321
www.glenpike.co.uk 
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Hit Object Question

2008-03-05 Thread Kenneth Kawamoto

Something like:

private function greenTint(e:MouseEvent):void {
   var ctfm:ColorTransform = new ColorTransform();
   ctfm.color = 0x00ff00;
   e.target.transform.colorTransform = ctfm;
}

private function redTint(e:MouseEvent):void {
   var ctfm:ColorTransform = new ColorTransform();
   ctfm.color = 0xff;
   e.target.transform.colorTransform = ctfm;
}

Kenneth Kawamoto
http://www.materiaprima.co.uk/

anuj sharma wrote:
How do I change the color of one sprite. I am sorry but I am little 
unclear of how does it work both toggling or change Sprite color. I am 
little new to this language .

Please help me out
Thanks
Anuj

On Tue, Mar 4, 2008 at 1:29 PM, Kenneth Kawamoto 
<[EMAIL PROTECTED] > wrote:


To make your approach work, you can draw a rectangle in ldrBdr and
bdrRep (one in red and one in green) and toggle the alpha of one of them
sits above the other (if you addChild() it goes above everything already
in the display list).

Or just change the colour of one border Sprite instead.

Kenneth Kawamoto
http://www.materiaprima.co.uk/

anuj sharma wrote:
 > Hi Kenneth
 > Thanks for the reply. So what's the solution of my problem?
 > Thanks
 > Anuj
 >
 > On Tue, Mar 4, 2008 at 1:01 PM, Kenneth Kawamoto
 > <[EMAIL PROTECTED] 
>> wrote:
 >
 > I think it's a typo but your BdrRep has no rectangle drawn,
and even if
 > you did have the rectangle, toggling the alpha of Sprite
underneath will
 > not give you any visual feedbacks...
 >
 > Kenneth Kawamoto
 > http://www.materiaprima.co.uk/
 >
 > anuj sharma wrote:
 >  > Hi all
 >  > I am trying to implement hit object in my project. I have
sprite
 > class and I
 >  > am loading multiple instances of UI Loader in my sprite
class and
 > displaying
 >  > it on the main screen. The user can drag and drop those
UILoaders
 > on the
 >  > main stage wherever they want.My aim was that if user
drops one
 > UIloader on
 >  > top of already placed UiLoader, then the already placed
UILoader
 > will be
 >  > replaced with the dropped UILoader. I am successful in
 > implementing that by
 >  > hitting hitTestObject method. All of my UIloaders are having
 > green color
 >  > border. Now my requirement is that as soon as the user places
 > UILoader on
 >  > top of already existing UILoader , the  UILoader which is
going to be
 >  > replaced changes border color from green to red showing
the user
 > that the
 >  > UIloader is being replaced and on Mouse release the
UiLoader is
 > going to be
 >  > replaced.
 >  > In short on mouse over, the border color has to be changed
and on
 > mouse
 >  > release, object has to be replaced. I am adding my
rectangle(in
 > Sprite
 >  > Container) as the border to the UILoader. Below is some
code to
 > make things
 >  > little clearer
 >  > Please help me in figuring out the problem.
 >  > Any help will be appreciated.
 >  > Thanks
 >  > Anuj
 >  > /*CODE
 >  > //UILoader Being Created
 >  > function CreateUILoaderObject(num:Number):DisplayObject
 >  > {
 >  > var myUILoader:UILoader = new UILoader();
 >  > var  container:Sprite=new Sprite();
 >  > myUILoader.name="myUILoader";
 >  > myUILoader.source = "/video/pic_"+(num+1)+".swf";
 >  > myUILoader.load();
 >  >
 >  > //Defining Border for the Selected Camera
 >  > var ldrBdr:Sprite = new Sprite();
 >  > ldrBdr.name = "border";
 >  > ldrBdr.alpha=0;
 >  > ldrBdr.graphics.lineStyle(2, 0x00ff00);
 >  > ldrBdr.graphics.drawRect(myUILoader.x+23,
myUILoader.y+45,
 >  > myUILoader.width, myUILoader.height);
 >  >
 >  > //Defining Border for the replaced Camera
 >  > var BdrRep:Sprite=new Sprite();
 >  > BdrRep.name="RepBorder";
 >  > BdrRep.alpha=0;
 >  > ldrBdr.graphics.lineStyle(2, 0x00ff00);
 >  > ldrBdr.graphics.drawRect(myUILoader.x+23,
myUILoader.y+45,
 >  > myUILoader.width, myUILoader.height);
 >  >
 >  > myUILoader.addChild(ldrBdr);
 >  > myUILoader.addChild(BdrRep);
 >  > container.addChild(myUILoader);
 >  >
 >  >
 >  > //Enabling Dragging & Dropping of Vide

Re: [Flashcoders] MovieClip Buttons in Flash CS3 ActionScript 3

2008-03-05 Thread Steven Sacks
If you really like this auto-button trick, check out my JSFL script 
which automates the process of making them.


http://www.stevensacks.net/2008/02/01/using-jsfl-to-create-auto-buttons-in-flash/


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