Re: [Flashcoders] Reliable way to split a string into an array oflines?

2007-09-16 Thread Danny Kodicek



I find this fast and reliable...

var lines:Array = str.split
("\r\n").join("\n").split("\r").join("\n").split("\n");


That's pretty much exactly what I ended up doing, thanks.

Danny

___
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] Compound interest formula

2007-09-16 Thread Danny Kodicek
- Original Message - 
From: "Kerry Thompson" <[EMAIL PROTECTED]>

To: 
Sent: Saturday, September 15, 2007 7:48 AM
Subject: [Flashcoders] Compound interest formula



I'm ok with math, but it's not my strong suite.

Does somebody have the compound interest formula, preferably in AS2 form?

It comes in various forms. The one I need is, given an interest rate, a
period of time, and an end goal, what monthly payments do you need to 
make.


In other words, assuming 8% annual return, and you want $1,000,000 in 25
years, how much do you need to set aside each month?



Here it is in Lingo (from my book - sorry some line breaks have come in, I'm 
on a computer with no Director so I had to cut and paste from the 
documentation). The second function is the one you're looking for (but it 
calls the first one).


Danny

on mortgage am, pc, pay, tp
--! ARGUMENTS:
am (loan amount), pc (APR), pay (monthly payment),
--! tp
(#monthly, #mixed or #yearly (default), the detail required
for output)
--! RETURNS: a string giving the rate of repayment
on a (capital and repayment) mortgage
set the floatprecision
to 2 -- (ensures two decimal place output)
-- set the monthly
interest, as a fraction 1+APR/1200
pc=1+pc/(1200.0)

i=0
oldam=am
ret=""
repeat while am>0
i=i+1

-- each month, increase the loan by the monthly interest, and
decrease it by the fixed payment
am=pc*am - pay
if am<=0
then
-- if the amount is less than or equal to zero then
the loan has been repayed
put "At the end of month"&&i&&"the
loan is $0"&return after ret
-- we can also calculate the
total money paid in interest
put "You have paid $"&(i*pay-oldam+am)&&"in
interest." after ret
am=0
else
if (i mod 12) = 0
then tx="year"&&i/12
else tx="month"&&i
if tp=#monthly
or (tp=#mixed and i<12) or ((i mod 12) =0) then
put
"At the end of"&&tx&&"the loan is $"&am&return after ret


end if

end if
end repeat
return ret
end


on mortgagecalc am, pc, yr
--!
ARGUMENTS: am (loan amount), pc (APR), yr (number of years),

--! RETURNS: a string giving the monthly payment for a (capital
and repayment) mortgage
at the given APR
i = 1+pc/1200.0
mth=yr*12
pow=power(i,mth)

pay=am*pow*(i-1)/(pow-1)
put "Monthly payment is"&&pay

mortgage(am,pc,pay,#year)
end 


___
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] Isometic game - zdepth managing formultiple movablecharacters

2007-09-13 Thread Danny Kodicek
 > I am reading all the replies and trying to see if I am 
> understand them correctly.
> Basically I have two options. Give every movable object the 
> depth of the screen _y value and make sure that objects can 
> never be on the same _y position.
> Second option.  If the movable objects only move one tile at 
> a time, meaning that their screen _y position could sometimes 
> be the same, I need to assign for every tile a range of n 
> numbers of depth that can be taken. Then check for an 
> available depth within each tiles indivudual range of depth , 
> when a movable objects is on a tile.
> 
> @Danny, could please explain your comment on subsorting a bit 
> more. I am not quit sure if I understand it.
> 
>  > However, you can optimise quite a bit  > by sub-sorting - 
> if you know that object 1 is in the rear 16 tiles and  > 
> object 2 is in the front 16 tiles, no need to check the z-order.

The best thing would be to look up binary sorting trees, quadtrees and so on
(a quick search on Wikipedia should take you to most of the interesting
stuff. Essentially, the trick is an extension of what I was describing
before: if you know which tile each object is on, then you can sort first by
tile, then by sub-tile position. In the same way, you can divide your tiles
into groups (usually you'd use a quadtree for this, it's probably the most
efficient in this instance) and keep track of which tile group each object
is on. If they haven't changed groups, you only need to sort within their
current group. 

The logic should be fairly clear - getting it efficient is a little more
complicated, but you should be able to find examples. Whether it's necessary
in your case, I can't say. As a general rule, I find these things are less
useful than they seem - in the most complicated case, you always have to
perform all your checks anyway, so your efficient calculation is going to
break down (especially as you've added a big pre-calculation step drilling
down through your search tree). If you're relying on your optimizations to
keep the game running at speed, it's going to slow down when you hit the
most difficult cases.

Danny

___
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] Reliable way to split a string into an array of lines?

2007-09-12 Thread Danny Kodicek
I'm looking for a simple, reliable method for splitting a string into its
constituent lines (at the hard line breaks - this isn't a text wrapping
thing). The problem is that line breaks could be Chr(10) or Chr(13), or
indeed both. I've done this: 
myArr =
myStr.split(String.fromCharCode(10)).join(String.fromCharCode(13)).split(Str
ing.fromCharCode(13))

I'm guessing I'm better off going the RegEx route, but I was wondering if
there's a quicker, simpler way.

Danny

___
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] toString(aArray[i]) ?? does this work

2007-09-12 Thread Danny Kodicek
 > Andy,
>   I see what you are saying, I think.  That the .toString() 
> has to be used as a method directly being addressed by the 
> object.  Like I said that what I think you are saying.  How 
> ever it seems I still can not get the string "myMCinArray1" 
> or  "myMCinArray2" or "myMCinArray3" etc  when I use the 
> toString on an array Element.
> 
> By the way, the scope in this case is actually  the Array
> lement(MovieClip)  -see coded snippet
> 
> setInterval(rollOvers,10);  //calls function 100/second to
> 
> function rollOvers(){
> for (i=0; i 
> aArray[i].onPress = function() {
>var myStr:String = aArray[i].toString();   
> //* THIS LINE
>trace(myStr);// still traces [object object]
>trace(i);  //gives me 126 .which is the array 
> length. if I could get this to give me the value of the Array 
> element clicked I would fine too.
> };

It's nothing to do with the fact that it's in an array. toString() always
gives [Object object] for movieClips. Try it: make a vanilla movie, put in a
single movieclip called 'wossname' then put 'trace(wossName.toString()' in
the first frame.

If you want to get its name, put aArray[i]._name, as suggested previously. 

Danny

___
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] Isometic game - zdepth managing for multiple movablecharacters

2007-09-12 Thread Danny Kodicek
> Every object gets a z-depth assigned. For the players the 
> zdpeth need to be set based on the tile they are at. This way 
> the players can walk 'around' the enviorment objects. For the 
> z-depth calculation I use the tile grid x and y plus the 
> width of the row, this generates an unique z-depth number and 
> makes sure that the higher the y, the bigger the z-depth , 
> thus objects appear infront of objects with a lower y index.
> Here is the problem I am trying to figure out. If two movable 
> objects, or even three of them are at the same time on the 
> same tile, then the above described z-depth managing will 
> fail. How do I deal with that?

If this is possible in your game then you'll need to either store sub-tile
positions and z-sort further on those (you could, for example, assign ten
z-slots per tile to ensure that you have more space) or randomly choose one
to be in front of the other (if there's only one position per tile, then it
doesn't matter which one gets drawn in front).

> 
> Then another question I have is this. Does every movable 
> object needs to check/swap z-depth on every frame. Wouldn't 
> that be to CPU intensive?

Depends how you do it. If there's only a few movable objects, this shouldn't
be particularly hard on the machine - Flash isn't the fastest thing in the
world, but it's fast enough for that. However, you can optimise quite a bit
by sub-sorting - if you know that object 1 is in the rear 16 tiles and
object 2 is in the front 16 tiles, no need to check the z-order.

Danny

___
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] Text Editor Undo/Redo Stack

2007-09-12 Thread Danny Kodicek
 > Hallo,
> 
> The text editor app is up and running now, thanks to those 
> folks that offered suggestions. I've got everything working 
> apart from the pasting of text. Does anyone know how it is 
> possible to do this? Any cool tricks to access the clipboard 
> from ActionScript (I've had a look online and found nowt).

It's not possible without a wrapper. Our text editor runs within Director,
so we paste the text into a Director cast member, then send it through to
Flash. Unfortunately this messes up with non-Western text, so we search for
"?" characters, and if there are more than a few in a row, we throw an alert
that recommends the users use Ctrl-V instead.

Never really understood the value of this security feature, especially given
that Shockwave doesn't have it.

Danny

___
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] Golden Ratio Spiral points

2007-09-10 Thread Danny Kodicek

What is a golden spiral?

http://en.wikipedia.org/wiki/Golden_spiral
"In geometry, a golden spiral is a logarithmic spiral whose growth factor b 
is related to φ, the golden ratio. Specifically, a golden spiral gets wider 
(or further from its origin) by a factor of φ for every quarter-turn it 
makes."


If you look further down the page, an exact numerical definition is given in 
terms of polar coordinates. To translate to normal xy cartesian coordinates, 
just plot the points (r sin theta, r cos theta) for successive values of 
theta using the formula given.


Danny


___
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] BitmapData subtract from every pixel

2007-08-21 Thread Danny Kodicek
 
> I have BitmapData A and BitmapData B;
> Is there a fast routine that from every pixel in A will 
> subtract the color of the coresponding pixel in B?
> I'm looking for a solution using the built-in BitmapData 
> functions, since a manual looop on every pixel will be 
> somewhat intensive (even if I use the getPixels>loop 
> ByteArray>setPixels hack to set the pixels, instead of a 
> setPixel() loop);

Interestingly, in Director this is easy using copyPixels and the #subtract
ink, so as the BitmapData object is essentially an updating of Director's
Image object, I'd have expected the same routine to be available in Flash.
Is there some undocumented parameter of the copyPixels function?

Danny

___
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] JSFL - How to creater a folder layer within a folderlayer

2007-08-17 Thread Danny Kodicek
 
> This is pretty easy making to layers.
> 
> fl.getDocumentDOM().getTimeline().addNewLayer("My Outer 
> Folder", "folder", false); 
> fl.getDocumentDOM().getTimeline().addNewLayer("My Inner 
> Folder", "folder", false);
> 
> However, I want to next the inner into the outer. For the 
> life of me, I can't figure this one out. Any guidance would 
> be appreciated.

I think you need to set the parentLayer property of the second layer to the
first one.

Best
Danny

___
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] onKeyDown/Up fires twice in dynamic TextField

2007-08-14 Thread Danny Kodicek
 > Don't rant me for using _root, cause this was only for 
> testing. I count the doubles out, which works fine for 
> keyDown. The following code traces:
> enter down
> enter up
> enter up

If this is only happening with Enter, I wonder if it's because Enter is
actually putting two characters into the text? (\n and \r?). Maybe you're
getting both of them from the OS. Is this a platform-specific problem? 

Danny

___
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] division operand

2007-08-14 Thread Danny Kodicek
 > I have this
> operand="÷";
> item.text=operand+" "+String(i);
> trace(item.text) /// ÷ 1
> but I don't see that operand in text area.
> text area: not html, Arial, all embedded text area HTML: the 
> same I see operand in trace but I don't see on the screen

It sounds like you just haven't embedded the character. Add it to the
embedded characters list and it should be fine.

Danny

___
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] division operand

2007-08-14 Thread Danny Kodicek
 > Hi
> Do anybody know how to solve one problem.I need to show in 
> string variables division operand as the horizontal line  
> with the dot above and below.
> So instead of  "10 / 2=" I need "10 ÷ 2 ="

So put it in :)

Just add the character and it should display fine (you may need to embed it,
though)

Danny

___
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] CDATA Html Text not working

2007-07-24 Thread Danny Kodicek
 > XML:
> 
> 
> The problem is the XML Node is not reading as a string and 
> the html text field reads the node as a literal string 
> instead of html text. I mean it prints something like "Blah 
> blah someLink  some bold text 
> " in my text field.
> 
> AS:
> var tt:TextField = 
> m.createTextField("txt",m.getNextHighestDepth(),0,0,0,0);
> tt.autoSize = true;
> tt.selectable = false;
> tt.embedFonts = true;
> tt.antiAliasType = "advanced";
> tt.html = true;
> tt.htmlText = local.ob.content; // myXml value 

How are you getting this local.ob.content?  That's the key issue, really.
Have you tried a trace() of this value?

My guess is that you're including the [CDATA bit of the field, which means
you're telling the field to render the text literally, which is exactly what
it's doing.

Danny

___
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] Casting to Array

2007-07-23 Thread Danny Kodicek



> That's a fair point. It's more the principle of the thing - it was
> frustrating not to be *able* to make it strict. But yes, leaving off
> the :Object would be a better solution.

Well, you can't do argument overloading in AS2 (nor AS3, I believe), so 
you can't have pure polymorphism in Flash the way you can in other 
languages like Java.  Such is life.


Alternatively, you could write your own class for the argument that could 
be an array or an object and then cast it strictly as that class.


Well, it would work just as well to have

Class StrictArray extends Array {
}

Ought to work perfectly (although I'd be interested to see whether bracket 
access still works). But yes, why bother? :)


Danny 


___
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] Hebrew input

2007-07-23 Thread Danny Kodicek



Hi,

I'm building an application that requires users to be abe to type in 
almost

any language.
It has basically two types of fields: 1 input and 2 dynamic fields.
I was able to get things working in the Flash IDE where I could type in
hebrew and any other language and got correct output in the dynamic 
fields.


However, once uploaded Internet Explorer did some strange things behind 
the

scene but I was able to type in hebrew.
In firefox I wasn't able to type in hebrew at all.
Both browser did output the hebrew correctly in the dynamic fields.

I'm not embedding any font; just Verdana is used as a font.


That's the key point. If you look back over several posts of mine on this 
list, you'll see that when using embedded fonts, you're in much more control 
than non-embedded. Without embedding, you're at the mercy of the browser and 
OS, and the result is that you really have no idea what will show up (quite 
aside from the question of whether your end-user will be able to see 
anything at all).


Unfortunately, embedding means that you definitely *won't* get RTL for free. 
Fortunately, if you're working with Hebrew rather than Arabic, the RTL 
algorithm is reasonably simple so you may find you can manage it by hand 
(it's less simple if you're allowing Bidirectional text, but still 
manageable). You could also try FlashRTL, which is pretty good but doesn't 
include any solutions for input.


Danny 


___
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] Casting to Array

2007-07-23 Thread Danny Kodicek



You're "hacking" it either way.  This one function is not going to cause
coder confusion.  You're leaving the type off so you can pass any type. 
Considering you type everything else, it's pretty obvious to anyone who 
looks at it what's going on.


Adding extra lines of code that put a parameter into an object is possibly 
MORE confusing than leaving off a type which the next line shows exactly 
why (if param instanceof).


AS3 has *, AS2 has blank.  I think it's hacky to add more lines of code 
versus what I don't think is hacky which is leaving off a type in AS2. 
That's HOW you accept any type of param in AS2.


That's a fair point. It's more the principle of the thing - it was 
frustrating not to be *able* to make it strict. But yes, leaving off the 
:Object would be a better solution.


Danny 


___
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] swf obfuscation - new challenge

2007-07-23 Thread Danny Kodicek
 The only method I can think of that might do what you're looking for is to
have some of the actual code work on the server. So for example you'd do
something that has a fundamental effect in the game, but you make its code
run on your server instead of on the client and just return the result (not
that different from making a multiplayer game with server-side scripting and
a dumb client).



> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf 
> Of Jim Berkey
> Sent: 23 July 2007 15:44
> To: Rákos Attila; flashcoders@chattyfig.figleaf.com
> Subject: Re: [Flashcoders] swf obfuscation - new challenge
> 
> Thank you Rákos,
> 
> I see now how one can get the data from Fiddler, I got it 
> quite easily without knowing or seeing the location of the 
> file online, just saving the response was enough.
> 
> Of course, now with Amaral's input on the php file, it is 
> easily readable, so the location can be easily found.
> 
> more work, . . . I must move outside another box somehow.
> 
> Thanks,
> jimbo
> 
> - Original Message -
> From: "Rákos Attila" <[EMAIL PROTECTED]>
> To: "Jim Berkey" 
> Sent: Monday, July 23, 2007 9:49 AM
> Subject: Re: [Flashcoders] swf obfuscation - new challenge
> 
> 
> >
> > http://www.tengerstudio.com/public/jumppeg2/
> >
> > That was not harder than previous ones :) I think you are going on a
> > wrong way - hiding the real games source URL and preventing the user
> > from downloading is simply impossible. If I use some kind 
> of a traffic
> > monitoring stuff everything is visible (personally I use 
> Fiddler - not
> > for cracking Flash games :) just for debugging my applications).
> >
> >  Attila
> >
> > 
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> =-=-=-=-=-=-=-=-=
> > From:Jim Berkey <[EMAIL PROTECTED]>
> > To:  Flashcoders mailing list 
> 
> > Date:Monday, July 23, 2007, 1:50:09 PM
> > Subject: [Flashcoders] swf obfuscation - new challenge
> > 
> --
> ===--
> > Okay, another brick in the wall to keep you from grabbing a 
> swf (the old 
> > joyluckclub.com peg game from flashkit again - my version 
> 4, I upgraded 
> > flash 5 as1 to flash 8, as2
> >
> > http://jimbo.us/Games/jumpPeg/index.html
> >
> > In the interest of transparency, here is what I've put 
> together so far:
> >
> > The goal is to have the best protection possible, while maintaining:
> > (1) - zero code obfuscation
> > (2) - technically easy enough for a n00b++ to implement
> > (3) - Sharing/knowing the technique does not make it weaker
> >
> > To this end, since so many of you last grabbed the game so 
> quickly, I've 
> > added some noise to the Herring, and I think I nailed shut 
> the door that 
> > Eric Priou showed us (executing the php script directly 
> from the browser 
> > address bar). Hopefully the number of folks that can grab 
> the game is 
> > reduced??
> >
> > Here is how it's done:
> >
> > Container swf (game.swf) holds a Red Herring faux game to 
> keep the --n00bs 
> > busy, and a script loaded via smoke and mirrors - logo.gif 
> is actually 
> > logo.swf - suffix changed after compiling - Flashplayer 
> obviously doesn't 
> > use the dot-three suffix to determine what a file holds. 
> None of this is 
> > necessary for the system to work, but is easy, fun and does no harm.
> >
> > The code in logo.gif checks to see that it is being loaded 
> onto a trusted 
> > url, and if so loads the real swf via a php script that 
> conceals the 
> > directory location of the real swf, and prevents caching. 
> Here is the php 
> > file that does this:
> >
> >  > $data = $_GET['data'];
> > header("Expires: Thu, 01 Jan 1970 00:00:00 GMT, -1 ");
> > header("Cache-Control: no-cache, no-store, must-revalidate");
> > header("Pragma: no-cache");
> > $content = file_get_contents("pathToRealSwf/$data");
> > echo$content;
> > ?>
> >
> > The only change you make to the php file is to change the 
> 'pathToRealSwf/' 
> > to your own relative or absolute path to the directory 
> holding the real 
> > swf. I eliminated a line in the script that typed the data as a 
> > shockwave/flash file, and removed the dot three suffix from 
> > 'rainbow.swf' - the actual file. So now, when one runs the 
> php script from 
> > the browser window, the browser doesn't know what it is 
> opening, and just 
> > shows the bytecode.
> >
> > If anyone wants the system so far, write me offlist and I 
> will send the 
> > source files for your examination. I'll also post the 
> system online once 
> > all the doors are closed that can be closed. It's probably 
> premature to do 
> > this yet, there are probably more doors to close, and more 
> bricks to add 
> > to the wall, but as we go along, anyone is welcome to what 
> I've done so 
> > far. If you have a suggestion for making the system stronger, I'd 
> > appreciate the help.
> >
> > So grab this version of the game, and let me 

RE: [Flashcoders] Casting to Array

2007-07-23 Thread Danny Kodicek
 > Danny,
> 
> I'm still not entirely clear on what you're attempting to do. 
>  Can you show more code to give us a bigger picture?

Thanks to everyone for suggestions and comments. Many of them, I suspect,
would suffer from the same problem, though. For Steven, here's the problem
in a bit more detail:

function generic(tObj:Object) {
if (tObj instanceof Array) {
doMyArrayFunction(tObj)
} else {
doSomethingElse()
}
}

function doMyArrayFunction(tArr:Array) {
...
}

This throws a compiler error because in the first function tObj is defined
as an Object and the compiler isn't clever enough to realise that by the
time we reach doMyArrayFunction it has to be of type Array. If the class I
was trying to cast it to was anything except Array, I could use something
like this:

function generic(tObj:Object) {
if (tObj instanceof MyClass) {
doMyFunction(MyClass(tObj))
} else {
doSomethingElse()
}

But because Array has a special constructor, Array(tObj) returns [tObj]
instead of leaving it unchanged and just casting it to an Array.

The solution I used works much the same way as Ian's: essentially it takes
advantage of the fact that Flash's compiler isn't able to check the object
type of sub-items of an object or array, so it ignores them (and assumes
you've done your job correctly). John's solution is probably better from a
strict OO standpoint, but mine works well enough, so...

Danny

___
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] Casting to Array

2007-07-20 Thread Danny Kodicek
 > As it's AS2, you might think about making it so 
> doMyArrayFunction will not expect an array, but will take anything:
> 
> class ArrayTest {
>   
>   public function ArrayTest(a) {
>   trace(a[0]);
>   }
>   
> }
> 
> 
> 
> new ArrayTest([1,2,3,4]);
> 
> works fine.

Yes, but I'm trying to do things 'properly' :)

I've been quite enjoying the discipline of strong typing and it seems a
shame to lose it for a little technicality. I like David's suggestion, which
I'd imagine works pretty fast.

Thanks
Danny

___
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] Casting to Array

2007-07-20 Thread Danny Kodicek
I'm trying to do something like this:

if (a instanceof Array) {
doMyArrayFunction(a)
}

the doMyArrayFunction expects an Array object, so this throws an error. What
I would normally do in this case is cast the object to the class I'm
expecting, but unfortunately Array(a) doesn't leave a unchanged, as it would
with most classes, but returns [a] - the array gets nested.

Anyone have a suggestion as to how I can get around this? The only thing I
can think of is Array(a)[0], which seems a bit stupid.

(I'm in AS2)

Danny

___
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] OT: SCORM 2004 conversion

2007-07-19 Thread Danny Kodicek
I'm currently re-entering the nightmare world of SCORM packaging (honestly,
how can something so simple have been made so damn complicated?). I'm
wondering if anyone knows of some good resources on SCORM 2004 - in
particular, does anyone by any chance have a simple tool that can convert an
IMS-compliant (not sure if it's SCORM 1.2 compliant, but it imports into
most VLEs so I assume it is) file into a SCORM 2004 one? It'll save me a
*lot* of work even if it's not perfect.

Thanks
Danny

___
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] Object properties not showing up in for..in

2007-07-13 Thread Danny Kodicek
 
> might the properties be hidden from enumeration?
> 
> http://objectpainters.com/blog/?p=33

Nothing like that - it's really a bog-standard object (not even from a
special class, just a plain {} )

Danny

___
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] Object properties not showing up in for..in

2007-07-13 Thread Danny Kodicek
 > If you switched to AS3, teh for in loop does not work on 
> 'sealed' classes, only on the legacy AS2 style prototype 
> based objects - like
> 
> myObj:Object = { prop: 1 , prop: 2, prop: 3 ...};
> 
> For sealed classes like iterating thru the,  say, props of a 
> ByteArray or NetStream class, use the ObjectUtil.toString // 
> new Reflection API myClass.getClass 
> Hope that helped a bit

Thanks, that's helpful to know, although in my case we're in AS2, so that's
not the issue.

I only needed it for debugging and I found the solution to the problem in
another way, so I'm reasonably ok now, but it's still a mystery.

Danny

___
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] Object properties not showing up in for..in

2007-07-13 Thread Danny Kodicek
This is weird:

trace(tProps.nformat.nalignment)
for (var i in tProps.nformat) {
trace (i + ": " + tProps.nformat[i])
}

Result:

left

That is: tProps.nformat.nalignment is equal to "left", but the for..in loop
is failing to mention it (or any of the other properties in the object).

I'm really baffled - especially because the same code was working fine until
today - I've rewritten the class, but this bit shouldn't be affected at all.

Any suggestions gratefully received
Danny

___
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] Re: Cross-domain Shared Objects

2007-07-11 Thread Danny Kodicek
 > On 11/07/07, Adrian Parr <[EMAIL PROTECTED]> wrote:
> >
> > Hi All,
> >
> > I am building an app that allows the user to personalise as 
> > screensaver online.
> >
> > 1) User chooses some settings and these are saved to a 
> shared object.
> > 2) User downloads Flash screensaver (made with Screentime 
> for Flash).
> > 3) Screensaver runs and loads in the shared objects from above.
> > 4) User sees personalised screensaver tunning!!
> >
> > Well, that is the theory. But it is looking like there is 
> no way for 
> > the local screensaver file to access the shared object that 
> was saved 
> > by the online SWF.

Sounds like a bad idea: if they remove the sharedObject in some way, their
screensaver will lose all its data. Is there no way for Screentime to give
access to screensaver properties that are accessed in the screensaver
dialogue box? That's where this info *ought* to be stored!

Danny

___
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] Mixing data types in an array...

2007-07-11 Thread Danny Kodicek
 > Hi,
> 
> well in the end everything is an object, so you are not 
> really mixing datatypes.
> 
> It all depends on the scope of your project I think, but 
> seeing the code below doesn't make me wanna be the maintainer 
> of that project when its author goes on vacation or sickleave :).
> 
> I think that in asking 'is this acceptable?' you are already 
> answering your own question. If you think its dubious, others 
> will think its dubious.

In other languages, Arrays are forced to have a single data type, but not in
AS. Still, what you've got there looks a lot more like something that should
be an object to me. What's more, if you're using switch() that's often a
sign that you've not organised your information very well (not always, but
it rings warning bells for me)

Danny

___
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] +Infinite Loop -Dignity

2007-07-11 Thread Danny Kodicek
 
> I feel really stupid right now. No, not that stupid. I mean  
> really stupid.
> Take the highest level of stupid you can imagine and double 
> that. Yes, now you've got it!
> 
> I have a class named Game.
> 
> Game.start() calls setInterval(this, "update", 1000).
> 
> Game.update() calls _gameScene.update().
> 
> _gameScene.update() has the following loop inside of it:
> 
> for (var i:Number = 0; i != elements.length; i++) { 
> elements[i].animation.update(); }
> 
> That FOR loop puts my humble PC into a coma. The variable 
> 'elements' is not undefined, and when I call 
> trace(elements.length) I get '2'. I tried clearing ASO cache 
> (whatever that's worth right now) as a silly precaution.
> 
> Excuse me whilst I hang myself.

I can't quite tell from your post whether you've solved the problem or not!
If not, my guess is that the animation.update() call is triggering the other
update events. Any chance the _gameScene object has found its way into
elements. Have you tried the debugger?

Danny

___
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] Get coordinates from illustration

2007-07-04 Thread Danny Kodicek
 
> Hi!
> 
> I would like to get all the coordinates from a shape made 
> with the Bezier tool in Flash or Illustrator into Flash so I 
> can use them to create a dynamic shape in Flash with the 
> curveTo syntax. Does anyone know if there is a tool or script 
> outthere doing this?

There's no way to do this completely accurately, because those shapes use
cubic Bezier curves, while the curveTo function (and Flash's other drawing
tools) use quadratics. However, you can make a first approximation version.
In JSFL there is an edge.getControl() function which will tell you the
position of the four control points of any contour edge. Loop through those
for your shape, and you have the full data. To convert into quadratic
beziers is fiddly, but you could make a first approximation by setting the
quadratic control point to the average of the cubic one. 

HTH (I can give you more if you need it, but not right now...)
Danny

___
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] limit of nodes of XML file that can be parsed?

2007-07-04 Thread Danny Kodicek
 > Hi Danny,
> 
> I'll definitely look into that, if not for this project, 
> it'll come in very handy for later ones. So far I heard of 
> SCORM, but never looked into it really in depth. Isn't it for 
> web based learning only?

No, it's a method for packaging course data which is used by most (not quite
all) virtual learning environments / learning platforms, including the
web-based ones (eg Moodle, MS Class server) and the ones designed for use
within a school network (Kaleidos). Our content is distributed mostly on
CD-ROM too, but it's designed to be loaded easily onto a network, and we've
packaged it up as learning objects and courses using SCORM (a painful
process, I may say - SCORM is a hideous beast of a specification). Having
said that, the stuff we deliver is Shockwave, so it does work through web
pages. I'm not sure how well these things handle exes - I suspect you might
find it doesn't work so well. Still, like I say it's worth looking into: at
least in this country, most educational institutions are getting learning
platforms (indeed, secondary schools are required to get one within the next
year), so they're all looking for content. 

Danny

___
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] limit of nodes of XML file that can be parsed?

2007-07-03 Thread Danny Kodicek
 > Hi Ron,
> 
> That seems very re-assuring. The problem I am having really 
> is that I find it very difficult to find out more about using 
> XML in Flash on a more advanced but still small scale level. 
> I can parse attributes, and nodes, but most examples deal 
> with 1-2 attributes, that can be easily be pushed into a 
> small one dimensional array, or node level depths of
> 1 or 2.
> 
> I am developing a course with 20 odd modules, and e3ach one 
> has 5 or so sections with content in it, and I am packing the 
> module titles into one XML so this can be changed globally 
> for all sections (which works fine), but I am having a 
> difficult time creating a proper structure for the content 
> XML, that holds the section content links (PDFs, audio files, etc)

Have you looked at SCORM? If you're making XML like this, it might be worth
your while to use the SCORM framework to store your data. It's bloated as
hell, but will mean that your courses can be easily imported into Learning
Platforms. If you use it from the outset, you may save yourself some work
later should you choose to use it.

Danny

___
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] Intermittent buttons

2007-06-29 Thread Danny Kodicek
 
> This is not a *major* issue but it's really annoying. I have 
> two buttons that navigate back and forth through a series of 
> images. (Flash 8, AS2). 
> They work fine when I first open the SWF. But on the same 
> screen is an input textfield with which a user can add or 
> change a title. The title change is saved when the textfield 
> loses focus (via onKillFocus()).
> 
> The problem is that once the user inputs a title, the two 
> controller buttons only work intermittently -- sometimes once 
> out of every two clicks, but often worse than that. The only 
> way the buttons will work every time is if the user moves the 
> cursor completely off the button and then back on. In that 
> case the buttons work very dependably.
> 
> Any ideas what the problem might be?

Just a thought: is it possible the textField is overlapping the buttons and
catching the clicks? Perhaps the field is auto-resizing and only causing the
problem when they enter the title

I doubt that's it, but it's the first thing that occurred to me.

Danny

___
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] Missing characters in XML

2007-06-22 Thread Danny Kodicek
 
> Ha!  That is the best case of "It's not a bug, it's a 
> feature!" I've ever seen.
> 
> Danny Kodicek wrote:
> >  
> >> you might have to go nodeValue.toString() first..
> > 
> > No, nodeValue is already a string. I fixed the problem by 
> reading the 
> > file in Director and passing it to Flash as a string - one 
> case where 
> > Director's lack of Unicode support turned out to be a virtue...

Admittedly, the only readon I had the problem in the first place is having
to spend the last year or so rewriting our software to work around
Director's lack of Unicode support :)

Which ironically is almost certainly due to be fixed in the next release of
Director.

Whenever that happens.

Danny

___
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] Missing characters in XML

2007-06-22 Thread Danny Kodicek
 
> you might have to go nodeValue.toString() first..

No, nodeValue is already a string. I fixed the problem by reading the file
in Director and passing it to Flash as a string - one case where Director's
lack of Unicode support turned out to be a virtue...

Danny

___
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] Missing characters in XML

2007-06-22 Thread Danny Kodicek
I'm having trouble reading and writing some characters to XML. I've got a
file with "." characters and I'm trying to read them and swap them for
arrows (u2192). But for some reason it's not managing to see them
(nodeValue.indexOf(".") is giving -1) 

I think the problem may be something to do with encoding. Is there any way
to find out what encoding Flash thinks the file has, or to force it to read
the file with a particular encoding? I'm wondering whether it thinks it's
UFT8 when it's actually ANSI. 

Thanks
Danny

___
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] RE: Missing characters in XML

2007-06-22 Thread Danny Kodicek
 
Never mind - I had the problem exactly right - I forgot Flash always assumes
UTF-8. That's okay, I can do it a different way.

> I'm having trouble reading and writing some characters to 
> XML. I've got a file with "." characters and I'm trying to 
> read them and swap them for  arrows (u2192). But for some 
> reason it's not managing to see them (nodeValue.indexOf(".") 
> is giving -1) 
> 
> I think the problem may be something to do with encoding. Is 
> there any way to find out what encoding Flash thinks the file 
> has, or to force it to read the file with a particular 
> encoding? I'm wondering whether it thinks it's UFT8 when it's 
> actually ANSI. 
> 
> Thanks
> Danny
> 

___
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] Selecting All in a TextArea

2007-06-22 Thread Danny Kodicek
 > I am trying to create a "Select All" button for a textArea 
> component and I cant seem to get the selected text to stay 
> selected. It gains focus, selects the text and then then 
> unselects itself immediately.
> 
> Am I missing something here?
> 
> btnSelectAll.onPress = function() {
> Selection.setFocus("txtBox");
> var nBegin:Number = Selection.getBeginIndex();
> var nEnd:Number = Selection.getEndIndex();
> Selection.setSelection(nBegin, nEnd); };
> 

Try btnSelectAll.onRelease instead - I suspect the button's getting focus
back when you release it.

Danny

___
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] onChanged and carriage return

2007-06-21 Thread Danny Kodicek
 > Are you testing this within the IDE?  Just a guess, but 
> perhaps you need to Control>Disable Keyboard Shortcuts

It's a good idea, but I don't think that's it - the key press is getting
through fine, it's just that the onChanged isn't happening.

I've hacked a solution by setting a flag in the onKeyDown event and manually
running onChanged in onEnterFrame if it hasn't been triggered. It works
fine, but it's still weird. As it happens, the same problem occurs in
reverse too: I can delete a carriage return without triggering onChanged
either (I decided I can live with this problem in this particular case)

Danny

___
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] onChanged and carriage return

2007-06-21 Thread Danny Kodicek
I've got a text field that is listening for onChanged events. For some
reason, it's not getting some of these events when they're carriage returns:

"a" : get the event
return : no event
"a": another event
return : no event
return : get the event
"a" : get the event
return : no event

That is: it misses the first carriage return after text, but gets events for
subsequent returns (until other text is written in)

Anyone else seen this behaviour before? I tried it in a vanilla movie and
the same doesn't happen, so it's got to be something I'm doing, but I can't
think what it could be. The textField is part of a complicated structure and
has a number of other events it's listening to, but surely onChanged is
onChanged?

Danny


___
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] Confused by preloading sounds and components

2007-06-19 Thread Danny Kodicek
 > I've set up this kind of preloader:
> 
> Frame 1: Preloader (when loaded, gotoAndStop frame 30) Frame 
> 10: Classes export (set in File->Publish 
> Settings->AS2->Settings) Frame 20: Components/MovieClips 
> placed on stage to force export Frame 30: The movie (calls 
> attachMovie, createClassObject, attachSound)
> 
> However I'm confused by 2 things (searched a lot for them):
> 
> 1) Why are the Components and MovieClips placed in frame 20
> displayed for a second despite the gotoAndStop(30) in frame 1?
> Isn't frame 20 supposed to be jumped over by that command?

Once you do things like attachMovie, frames and the timeline become pretty
much irrelevant. If you don't want them to be seen, place them offscreen
somewhere.

> 2) My second annoyance is that the sounds, that I put into
> that component at the stage in frame 20, are played.
> How could I stop them from playing, but still preload them?

I'd do it by loading them with some other command, like loadVariables. It
should cause them to be downloaded without having to put them on stage
(haven't tried it, but it should work)

Danny

___
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] Re: External preloader using loadClip() - is it agood idea?

2007-06-19 Thread Danny Kodicek
 > Hi, one more small comment:
> 
> On 6/18/07, Alexander Farber <[EMAIL PROTECTED]> wrote:
> > I've solved my problem of the loadClip('Main.swf', ...) 
> delivering the 
> > same old version of the Main.swf by the standard trick of 
> appending a 
> > random string.
> 
> I've realized, that an external preloader doesn't work well 
> for my project, because the latter is big and I'm changing it daily.
> 
> IMHO flash player makes a stupid thing with its cache:
> 
> It should send an If-Modified-Since request to the web server 
> and serve the .swf file only if the web server has replied 
> with a "304 Not Modified".
> 
> But instead the flash player just always sends the .swf file 
> if it has found it in the cache, without the check...

It's not Flash's cache but the browser's. I don't think Adobe have any
direct control over how the browser requests files (I may be wrong, I don't
know a lot about what's going on behind the scenes). In any case, you can
always force a preload by appending a dummy variable to the server string,
if you need to, although I'm not quite clear from your comment what you want
- preloading and cacheing are pretty much independent things.

Danny

___
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] Reading XML from CDROM through Flashplayer

2007-06-19 Thread Danny Kodicek
 > Indeed its online content that I want to read from a CDROM.

Sorry, didn't read properly :)

 I 
> guess the solution is to use System.security.allowDomain() to 
> the url where the xml is hosted. Right ?

Actually, I've never encountered a problem accessing online content from a
CD-ROM either. I think it's only if the Flash movie itself is in a browser
that you'll have to do that. But I'm prepared to be proved wrong - try it
and see!

Best
Danny

___
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] Reading XML from CDROM through Flashplayer

2007-06-19 Thread Danny Kodicek
 > Hi,
> 
> Will I have a problem when I´ll try to read online content 
> from a flash exe file on a cdrom through the xml object? I 
> remember the security restrictions of the flashplayer..
> If there is a problem, what can I do to avoid it ?

If it's offline content accessing offline files, you should have no
problems. The security restrictions only apply to online content.

Best
Danny

___
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] Grid / Math - getting neighbouring positions

2007-06-19 Thread Danny Kodicek
 > I'll take it ;)
> 
> thanks for everybody's help.

Just catching up on this, you might want to try looking up floodFill
algorithms - that's pretty much what you're doing.

Danny

___
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] Trap mouseDown events

2007-06-18 Thread Danny Kodicek

If I have a listener that's getting onMouseDown events, is there any way
that I can stop those events getting to it? I'm trying to make an event that
happens when I click anywhere *except* certain buttons. I hoped that I could
set a flag on clicking the buttons, but unfortunately the onMouseDown event
happens first. Otherwise, I'm going to have to do something like setting a
flag on the mouseDown, *removing* the flag with the button click, then
running my listener action on a timout or enterframe if the flag hasn't been
removed.

Best
Danny


___
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] setNewTextFormat

2007-06-12 Thread Danny Kodicek
 
> no danny. setNewTextFormat means that all NEW text in the 
> textfield will be formed. setTextFormat is only once and not 
> for new text. and if you do some new text via AS 
> setNexTextFormat will work fine..

Not for me, no. I always have to run setTextFormat after setting with AS,
whatever I do with setNewTextFormat.

Danny

___
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] setNewTextFormat

2007-06-12 Thread Danny Kodicek
 
> Hi All
> 
> I have a loop that creates pages, creates textfields then 
> adds text. Some of this text has font tags and some doesn't. 
> I want to use a default textFormat so that an embedded font 
> is used when no  
> currentPage.createTextField("my_txt", 1, 5, 5, 
> currentPage._width - 10, currentPage._height - 10);
> currentPage.my_txt.autoSize = false;
> currentPage.my_txt.multiline = true;
> currentPage.my_txt.wordWrap = true;
> currentPage.my_txt.selectable = false;
> currentPage.my_txt.embedFonts = true;
> currentPage.my_txt.html = true;
> 
> var my_fmt:TextFormat = new TextFormat();
> my_fmt.font = "Arial";
> currentPage.my_txt.setNewTextFormat (my_fmt);
> 
> currentPage.my_txt.htmlText = this.Model.pages[i].text;
> 
> This works fine for text that has Arial specified in a font 
> tag but for all the other pages which are just text no text 
> appears (when tracing I see that Times is used which is not embedded).
> 
> Why isn't this working? The setNewTextformat should change 
> the default textformat for the field from then on? I am still 
> getting Times though.

setNewTextFormat is, in my opinion, broken: it works for text entered by a
user but not for text entered through ActionScript. You need to run
setTextFormat manually after changing it.

Danny

___
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] >> function - AS2

2007-06-11 Thread Danny Kodicek
> this.cli_mc.hu_btn.onPress = function() {
>buttonfunction();
> };
> 
> Function buttonfunction(){
> cli_mc._visible = 0;
> _root.mtit_txt.text = "Cliniques";
> _root.categ_var = "CLINIQUE";
> _level41.mar = "cli";
> _root.liste();
> }
> 
> -- Move your onPress code into another function, then you can 
> reference that function through ActionScript, and through 
> other functions like onPress.

or indeed just run this.cli_mc.hu_btn.onPress() manually - should work just
fine. 

Danny
 

___
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] Private var not accessible?

2007-06-07 Thread Danny Kodicek
 > I have a simple class and I can't access a private var after 
> using setTimeout... I typed this up to show whats happening:
> 
> class foo extends MovieClip
> {
> private var nTime:Number = 0.75;
> private var delay:Number;
> 
> function foo()
> {
> // stuff
> };
> 
> public function doSomething():Void
> {
> trace( nTime ); // works fine [0.75]
> var delay = _global.setTimeout( delayedFunc, 1000 ); };
> 
> private function delayedFunc():Void
> {
> trace( nTime ); //undefined ?
> };
> }
> 
> ?? I could use setInterval and kill it after the first fire, 
> but setTimeout is nicer. This is AS2 obviously.

Is this a case for Delegate? Looks to me like you've lost scope as a result
of going to _global.

Danny

___
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] Surely simple: textField.restrict to block carriage return

2007-05-31 Thread Danny Kodicek
I want to allow users to enter anything except carriage returns in my input
field (but only sometimes). Is there no way to do this using
textField.restrict? I tried "^\r", "^\n", "^\u000d", none of which made any
difference. I know I can do it by setting multiline = false, but it's a bit
irritating for restrict not to work.

Danny

___
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] dynamic text not wrapping

2007-05-30 Thread Danny Kodicek
 > HI guys,
> 
> an easy one - I can't get a dynamic text filed to wrapp text 
> around that I am asigning to it with:
> 
> ' messBox_txt.text = "display this really looong sentence ..."; '

Have you set the wrap property of the field?

Danny

___
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] Can I read XML before it is loaded?

2007-05-15 Thread Danny Kodicek
 > Hi there, I am sure I remember coming across a way of reading 
> an XML file before it is fully loaded though I can't find it. 
> What I would like to do is load all the information from an 
> XML file but only if an attribute in the first node has 
> changed (this is like an ID that the Flash app can use to 
> decide whether or not to load all of the XML unless it is a 
> new version). Has anyone else heard of this of or is this 
> wishful thinking?

You could parse the initial text manually, but in fairness the XML object is
pretty fast and I'd imagine you're better off just letting it load. If you
want to have an ID for whether the xml has changed, why not just put one
into a different file?

Danny

___
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] Identifying a unique Flash plugin

2007-05-15 Thread Danny Kodicek
 
> Hi
> 
> Is there any way to uniquely identify a single Flash plug-in? 
> Perhaps there is an indentity code, or is there anyway to get 
> something unique from a user's computer through Flash 
> (something like the MAC address)?
> 
> Basically we need to know whether a user has played a game 
> before but we don't want them to register / login, and we 
> can't rely on cookies / local shared objects.

No, without cookies/shared objects there's no way to be sure. If you need to
be reliable, they have to log in; if you only need reasonable reliability,
then you can go for cookies (incidentally, logging in is better because it
means different users can share a computer, and one user can use different
computers). Alternatively, I find 'skip intro' to be a reasonably effective
option :)

Danny

___
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] Mortgage calculator in Flash or other technology?

2007-05-15 Thread Danny Kodicek
 > Hi there
> 
> A client has asked me to create a mortgage calculator for 
> their site and I was thinking of doing it in Flash. However 
> the client is concerned that not everyone has Flash plugin. 
> Therefore I need to consider the alternatives, one of which 
> is to do it in javascript. However I read that 7% of internet 
> users do not have javascript turned on.
> 
> I would appreciate any advice on what the best technology is 
> to create this.
> Hopefully Flash is the answer:)

I'd say the only option for people with no javaScript is going to be a
server-based solution like asp. Certainly your web user with no Javascript
won't be likely to have Flash either. 

Danny

___
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] simple movie scroller Bug.

2007-05-15 Thread Danny Kodicek
 
> 
> stop();
> btn.onRelease = function(){
>  gotoAndStop("start");   //   start label is in the middle of 
> the  mov about frame 150.
>  this._alpha = 0;
> // I turn off the buttons vis.  I will probably load it and 
> unload it in the final copy. Not sure on the edicate for 
> this.  less code this way.  Less clutter the other way 
> unloading the movie.
> 
>  frameNav();  //call the function
> }
> 
> function frameNav(){
> 
>  onEnterFrame = function(){  //simple onEnterFrame
> 
>  movFrame = _xmouse; 
> 
>  //movie frame which is about 300 frames should run from 
> _xmouse = 0  to _xmouse = 300  gotoAndStop(movFrame);  
> //gotoAndStop Movie pans as long as you slide the mouse, 
> stops where you want it to stop.
> }
> 
> }
> 
> here is the problem  the mov for some reason behaves 
> exactally as you would expect from reading the code. except 
> one thing. For some annoying reason, it stops at frame 177 or 
> 178.  So my code does not refer to that frame, nor do I have 
> any stops, labels, mcs or any actionscript at all on that 
> frame.  So I really am stumped.  Again this is something I am 
> asking because, it seems to me at this point that there is an 
> increasing chance that there is a common bug.  Otherwise???

I think I understand what you're asking. Is this 'movie' you're scrolling
through a FLV? I wonder if you're having trouble scrubbing through it
because it doesn't have enough keyframes?

Danny

___
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] Motion to combine coders and newbies.

2007-05-14 Thread Danny Kodicek
> But generally, I'd rather have FlashCoders split up into 
> /more/ lists rather than combining it with FlashNewbies. A 
> list each for AS2, AS3, FMS, architecture, components and so 
> on. We could then choose which ones to subscribe to, and 
> those of us gifted with the seemingly rare ability to set up 
> email folders could organize them as they please.
> For me, personally, that would mean I'd subscribe to all and 
> collect those I'm not currently interested in in a general 
> knowledge-base folder for possible later use. That would 
> reduce the number of mails that I personally consider noise 
> (although they are perfectly legitimate in a general 
> FlashCoders list) and thus greatly increase the value the 
> rest has for me, making me read more of it. I imagine that 
> would work the same for most.

I understand the theory but unfortunately there's a down-side. For *reading*
lists, it's great to have them categorised in this way, but for *posting* to
them, it can cause problems. As a Director user, I have quite a few lists to
choose from, among which are Dir3d-l, devoted to 3d issues, and dirGames-L,
devoted to games programming (in Flash too, incidentally - it's a good list
and might benefit from some Flash heads). Now, when I have an issue related
to 3d in a games context, which list do I post to to ensure the right people
read it? Either I have to choose one or the other, resulting in missing out
on some potential advice, or I cross-post, with the result that those who
read both lists (a fair proportion) get two copies of the same message.
Neither really is ideal. In the end, a general list for experts can be more
useful, with a serious naming and shaming of those who post messages with
crappy subject lines.

I'm not saying the idea is unworkable, but it's worth pointing out what we
lose by it.

Danny

___
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] Layout Manager

2007-05-14 Thread Danny Kodicek
 > I wonder if I can use something like Keith Peter's Particle 
> Class and have the clips repel a bit on their own and have 
> that take care of the layout - if done with some care.

Good thinking, yes, that ought to work if your content is of a sensible kind
of shape - of course, there's no guarantee that they won't be obviously
clumped at the end, in fact I'd expect they mostly would be a bit, but you
can't have everything.

Let us know how this turns out, I'd be interested to see the end result.

Danny

___
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] Strange problem with AS2 class

2007-05-14 Thread Danny Kodicek
 > I highly suggest you get FLASC
> 
> http://www.osflash.org/flasc
> 
> 1) Your code will be cleaner.  MTASC forces you to write 
> clean code in order to compile.  It is more strict than the 
> Flash IDE compiler.
> 
> 2) MTASC helps identify bugs before they happen.  For 
> instance, I had an issue I couldn't figure out for some 
> reason.  The issue ended up being that I had renamed a class 
> but had not renamed its constructor.  For some stupid reason, 
> the Flash IDE compiler doesn't throw an error when you put 
> super(); in a different function than the constructor, but 
> MTASC does (one more reason to put super() in your 
> constructor, and one more reason to always use MTASC to 
> compile your Flash movies).
> 
> If your code compiles just fine in MTASC, then you've got an issue. 
> Until then, you haven't exhausted all your debugging options. 

You've finally sold me on trying this out, but I have a question: I'm
currently using JSFL to export several different versions of my source files
(different compilations with different character sets embedded). Is there a
way to use either FLASC or MTASC to compile through JSFL? I'm guessing not,
as these involve changes to the content of the FLA file, not just the code.
But could I make various template swfs and use MTASC (with or without FLASC)
to recompile all of them at once?

Danny

___
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] Layout Manager

2007-05-14 Thread Danny Kodicek
 > I am looking for a kind of layout manager (easy to use & 
> fairly lightweight). I have done a little digging, and 
> haven't found too much.
> 
> This is for an AS2 project.
> 
> I have a viewing port, and will fill it with Objects of 
> random size. I only want to make sure that I don't end up 
> clumping items too close together, trying to get them to lay 
> themselves out fairly evenly within the target viewport. I 
> will be altering their scale and rotation a bit.
> 
> I could tackle this myself, but I'd rather code more fun 
> things than this.
> 
> Any ideas or links?

This sounds like it might be a job for a Gauss-Seidel kind of method
(basically, 'resolve a bit at a time'). You've got a system with some
variables (the position, scale and rotation of each object) and constraints
(presumably you want the elements to be non-overlapping). What I'd do is
start by spreading the objects evenly (probably in a spiral, it's less
obvious than a grid), then tweak the configuration iteratively a few times
until it meets my requirements. It's the same basic method as is used in
ragdoll bones animations.

Danny

___
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] Creating a text highlight tool

2007-05-11 Thread Danny Kodicek
 > Hi Danny, it would be multi line text and I don't know if it 
> will be center aligned. Maybe some parts will be. I didn't 
> really get the technique you described. Can you please try 
> and describe it again? Or is it possible that you share the 
> code that you have? I can even compensate it somehow if it gets used.

My code is a bit complicated but the key function is this (warning: untested
email version; only works on left-aligned fields with a single text format -
no HTML. Also probably needs a bit of adjusting to take margins into
account. All these issues are fixable if necessary!):

function charToLoc(tPos:Number, tField:TextField):Object {
// this returns an object {x:..., y:...} - it could be a Point object if you
wanted

// find the text to look at and create a new textField for testing
var tTempField:TextField = tField._parent.createNewTextField("temp",
tField._parent.getNextHighestDepth)
var tFormat:TextFormat = tField.getTextFormat()
var tText:String = tField.text.substr(0, tPos)

// first find the bottom of the line:
var tStartOfLine:Number = lastCharBeforeLine(tText, tTempField, tFormat)
// now we know the y position
var tY:Number = 0)
if (tStartOfLine > 0) {
tTempField.text = tText.substr(0,tStartOfLine)
tTempField.setTextFormat(tFormat)
tY = tTempField.textHeight
}

// and the x position is got from the width of the remaining text
tTempField.text = tText.substr(tStartOfLine)
tTempField.setTextFormat(tFormat)
return {x: tTempField.textWidth, y:tY}

}

function lastCharBeforeLine(tText:String, tTempField:TextField,
tFormat:TextFormat):Number {
// get hald the line height
tTempField.text = "Ay"
tTempField.setTextFormat(tFormat)
var tHalfLine:Number = tTempField.textHeight/2
tTempField.text = tText
tTempField.setTextFormat(tFormat)
var tBottom:Number = tTempField.textHeight - tHalfLine
var tMax:Number = tText.length
var tInterval:Number = 16
// find an interval during which the line drops
do {
var tMin:Number = Math.max(tMax - tInterval, 0)
tTempField.text = tText.substr(0,tMin)
tTempField.setTextFormat(tFormat)
} while (tTempField.textHeight > tBottom && tMin>0)
if (tMin == 0) {
//we're on the first line
return 0
}
// otherwise home in on the point at which the line drops
while (tInterval>1) {
tInterval /= 2
var tMid:Number = tMin + tInterval
tTempField.text = tText.substr(0,tMid)
tTempField.setTextFormat(tFormat)
if (tTempField.textHeight < tBottom) {
tMin = tMid
}
}
return tMin
}

I'll leave it up to you to adapt these for your purposes; I hope they help.

Best
Danny

___
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] if(color == X) {} looking for method.

2007-05-10 Thread Danny Kodicek
 > ...I am wanting to run a color of instance test.   I am 
> wondering if I can do this?
> 
> attachMovie("shapes","shapes",num);
> 
> if( shapes /*color*/  == 0x33){
>   // action(s)
> }
> 
> // this is sudo code but basically I want to know if I can 
> test for color.

A library symbol doesn't have a colour - what exactly are you trying to do?

Danny

___
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] Creating a text highlight tool

2007-05-10 Thread Danny Kodicek
 > On 5/10/07, Danny Kodicek <[EMAIL PROTECTED]> wrote:
> > I've done it in the past (although in the end I didn't use it) by 
> > creating a function that homes in on the exact coordinates of the 
> > insertion point by adding text into a hidden field and 
> using textWidth 
> > / textHeight (the tricky part is finding the start of the current 
> > line, the rest is fairly easy, although I'm not sure how you'd do 
> > centre-aligned text). It sounds hideous, but actually Flash 
> is pretty 
> > fast at that kind of thing and it worked fine in real-time for 
> > reasonably short text. If your text is single-line, 
> obviously it's much easier.
> 
> Just as an aside - all this sort of stuff is a lot easier in 
> AS3, and it's much much faster. Take a look at the source 
> code to the RichTextEditor control for some ideas.
> 
> As a benchmark, AS3 is fast enough that I can take the HTML 
> content of the rich text editor, transform it into a 
> different XML document, run some analysis on it, add extra 
> markup and transform it _back_ into an HTML document that 
> gets inserted back into the rich text editor between 
> keystrokes without the user noticing; without any slowdown.
> For a multi-page document. Now that's _fast_. :-)

Yeah, but I bet it doesn't work with Arabic ;)

Danny

___
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] Creating a text highlight tool

2007-05-10 Thread Danny Kodicek
 > Hi list, any tips on how to create a text highlighter? The 
> perfect solution will be that I use the text cursor inside 
> the textfield. Now, I was thinking of using drawing API on 
> the invisible mc below the textfiled and when I would click 
> in the textfield I would start drawing a rectangle on that mc.
> But, the problem is that with the text cursor you can click 
> anywhere between the lines and it will select the closest 
> line. So I can't get the exact y coordinate where to start 
> drawing the rectangle.
> 
> Also, I don't think I can use background-color css property 
> as it's not supported according to Flash documentation.

It's a very tricky problem - not only are there the problems you mention,
but also if they're selecting multiple lines you need to draw three
rectangles rather than one - the shorter top and bottom part-lines and the
full lines in the middle. 

I've done it in the past (although in the end I didn't use it) by creating a
function that homes in on the exact coordinates of the insertion point by
adding text into a hidden field and using textWidth / textHeight (the tricky
part is finding the start of the current line, the rest is fairly easy,
although I'm not sure how you'd do centre-aligned text). It sounds hideous,
but actually Flash is pretty fast at that kind of thing and it worked fine
in real-time for reasonably short text. If your text is single-line,
obviously it's much easier.

Best
Danny

___
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] BitmapData.dispose()

2007-05-04 Thread Danny Kodicek
I've only just noticed the dispose() method of the BitmapData object. Is it
strictly necessary? That is: if I just let a BitmapData object get garbage
collected, will the memory fail to be released? And if not, why would we
need this method instead of plain old delete?

Danny

___
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] Syntax for dynamically calling a function

2007-05-03 Thread Danny Kodicek
 

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf 
> Of Alistair Colling
> Sent: 03 May 2007 15:27
> To: flashcoders@chattyfig.figleaf.com
> Subject: [Flashcoders] Syntax for dynamically calling a function
> 
> Hi there, I want to call a function but want to able to call 
> it dynamically so a string that is passed will determine 
> which function is called.
> My reason for this is I have an interface with a number of 
> buttons that have different labels but that look the same and 
> need to call different functions. I was going to make one 
> button and duplicate it then name it so it will call a 
> function depending on what it's name is. My code would go 
> something like this:
> 
> ///inside 'button' MC named 'pictures'
> var label:String = this._name
> 
> this.onPress = function(){
>   //want to call function from here, dictated by the name 
> of the MC, not sure of this sytanx
>   this._parent.label()

Nearly right: 

this._parent[label]()

Danny

___
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] blur every clip...

2007-05-03 Thread Danny Kodicek
 
> Hello,
> 
> Hi,
> 
> In my app I need to show a modal dialogue and blur/unblur all 
> on-stage clips while the dialogue is active.
> 
> So, whats the cleanest AS2 way to do this - I'm in Flash 8 
> but don't want any prototypes.
> 
> I need to extend all movieclips so does this mean I will need 
> to register every movieClip in the library with a class - 
> thats a bit longwinded...

How about creating a new BitmapData object from _root?

Danny

___
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] flash and Arabic

2007-05-02 Thread Danny Kodicek
 
> Thanks for the help!
> 
> In your professional opinion is "almost the same" good enough 
> or will I need to tweak the char set? So you know I'm only 
> displaying short button labels and headings.

I don't speak Arabic or know anything about it other than what's in the
Unicode data :) I get the impression that Persian is a superset of standard
Arabic (like adding accented European characters to standard Roman), so
something that works with Persian should display standard Arabic correctly
too (I think there are some differences with ligatures, but they're minor).
I know nothing about Sorani, but I'd suggest trying it out and seeing how
things turn out.

By the way: if your text is short and doesn't need line breaks, you *may*
find that if you use non-embedded fonts your text will display correctly
with no work at all. Try that first if you're willing to sacrifice a little
quality.

> Also we're getting the copy supplied from a translation 
> house, the Project Manager said this will be coming over as 
> pdf. I've got a full copy of Acrobat so hope this shouldn't 
> be a problem. If it is would you recommend any other format 
> for them to supply in?

AFAIK, Acrobat supports RTL languages fine (although you may need to install
the language pack on your machine).
> 
> I can't seem to log into the archives, which is frustrating.

You should be able to search them with Google: try 'flashcoders kodicek
arabic' as a search string.

Best
Danny

___
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] flash and Arabic

2007-05-02 Thread Danny Kodicek
 > Has anyone had any experience of using the Flash RTL classes 
> from here:
> http://www.flashrtl.com/
> 
> They seem to be good for Persian, but need porting to other 
> char sets, and a general clean up/re-write.
> 
> To do this I need to get a better idea of what needs to be 
> converted, the order of words or the order of characters but 
> not words, or both? I guess this is also dependant on the 
> source, for me I'm loading in from XML.
> 
> It's still early in the project and I'd like to get this 
> nailed down before committing 100% to doing RTL.

If you look back over the archives you'll find a few posts from me on this
subject. For display purposes you may find these classes are enough for you
- Persian and standard Arabic are almost the same in terms of the character
set, and Hebrew is much simpler (just plain bidirectional). 

Best
Danny

___
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] help

2007-05-02 Thread Danny Kodicek
  
> how can we print a variable value in our execution screen..?

'execution screen'? Do you just mean displaying a variable on screen? Try

var tField:TextField = _root.createTextField("out",
_root.getNextHighestDepth(), 100, 100, 200, 20)
tField.text = String(myVariable)

Danny

___
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] factory with varying numbers of params

2007-05-02 Thread Danny Kodicek
 > Thanks a lot for all the replies. Most helpful. It's a funny 
> situation. I'm using a deserialised XML file to dictate the 
> content and layout of each page. A page might contain 1. A 
> heading, 2. A TextField 3. A link or it might contain 1.A 
> heading 2. A thumbnailMenu or various other permutations.
> I have written a class for each item that implements an IItem 
> interface, and they all have certain identical methods 
> (setPosition(), setScheme(), close() etc), but they also have 
> unique props that need to be set (The label of the header, 
> the label / path of a link etc.) Also to comlicate things, if 
> the item is a menu, I need to attach an eventListener.
> 
> I like the idea of using classes to encapsulate the 
> parameters, but where would these be created? I guess it 
> would make sense to do it at deserialisation, but then that 
> gives two places that will be subject to change and that is a 
> bad thing. I could do it in a separate method in the factory 
> I suppose.

This sounds like what I'm doing at the moment. What I did was instead of
using an interface, to make all my elements inherit the same base Element
class, then when running a createElement function, I simply defined it as
returning an instance of Element. It sounds to me like you're giving in to a
common problem of letting the OO cart pull the design horse - you're trying
to force a function to be strongly typed when by design it's creating
elements of different types.

Danny


___
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] rotate a cube

2007-05-01 Thread Danny Kodicek
 
> Hello Flashcoders
> 
> I am trying to rotate a cube which i made in the flash 
> authoring environment. However it is not a real cube but I 
> don't want to use API to make a cube first and then rotate 
> it. I want that a cube which have a specific design then it 
> is rotate in the 3d environment using flash Actionscript.
> 
> Please help me I don't find any solution and now i think that 
> might be it is not possible to rotate such type of cube.

If you made your cube as a perspective object in Flash, you're right, you
can't rotate it automatically (how would Flash know what the rest of it
looked like?!) There's no way to do what you're trying without using some
actionscript (and a fair amount of maths). However, there are a fair number
of 3d tutorials out there - a Google on 'rotate cube actionscript' brought
up this one as a first hit:
http://www.kirupa.com/developer/actionscript/rotation_center.htm

Danny

___
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] Have anyone idea

2007-04-30 Thread Danny Kodicek
 > Hello everybody!
> 
> I want to know that if we make a cube in flash then want to 
> play with it like shock boy at www.neostream.com . If any one 
> have idea so please tell me and one thing more is, please 
> give me some resources to learn physics and trignometry for flash.

For the last, you might like to try my book Mathematics and Physics for
Programmers:
http://www.amazon.com/gp/product/1584503300/sr=8-1/qid=1142351038/ref=pd_bbs
_1/104-0280101-3567142

It's been fairly well reviewed on this list in the past, so it's not *pure*
shameless self-promotion :)

Best
Danny

___
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] flowcharting

2007-04-30 Thread Danny Kodicek
 
> OpenOffice has a nice drawing tool with all of the 
> flowcharting symbols defined. www.openoffice.org You can 
> colour and shade them to your hearts content.

If you want to look at alternatives, I'm a fan of SmartDraw, which is good
for mocking up interfaces as well. For flow charts specifically, I remember
using WizFlow as a decent cheap programme.

Danny

___
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] WhITE SNOW and Seven Dwarf - MAth Problems!

2007-04-27 Thread Danny Kodicek
 > OK danny, your script work fine. sorry for not testing it first. 
> here is the script in conjunction to my prior post. on frame 1:

Before you start timing different methods, you should remove all your
'trace' lines, they add a time overhead of their own. Try it again with no
traces and I suspect you'll see very little difference between the two
scripts (and they should both run almost instantly - creating 700 clips
doesn't take that long)

Danny

___
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] how to write a class that loads XML?

2007-04-27 Thread Danny Kodicek
 > Hello Flash coders.
> :)
> 
> Could anyone help me to fix my class code? I can't find any 
> reference anywhere that will help me... I'm trying to load 
> XML via a generalized class object, but the data in postXML 
> never makes it to the parseXML constructor, any help is 
> greatly appreciated!
> 
> Thanks!
> 
> Sebastian.
> 
> [CODE]
> 
> class XMLoader {
> 
> private var postXML:XML;
> 
> private function parseXML () {
>//do something with postXML
> }
> 
> public function XMLoader (__file) {
> postXML.ignoreWhite = true;
> postXML.load(__file);
> postXML.onLoad = parseXML();
> }
> }

You can use the Delegate class to send the onLoad function back to your
object:

postXML.onLoad = mx.utils.Delegate.create(this, parseXML );

Best
Danny

___
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] Curves question for math gurus

2007-04-26 Thread Danny Kodicek
 > Hello leolea
> 
> > I'm trying to figure out a way to have objects "snap" to 
> this curved 
> > line. I would distribute them over the _x axis, and I need 
> a formula 
> > to get their _y position on the curved line.
> 
> - you need to find an intersections between 2D Bezier curve 
> and vertical lines.
> Uou can use our geom package for it:
> http://www.bezier.ru/rus/AS2/sources/ru.bezier.zip
> 
> good luck!

Be aware, though, that the vertical line might well not give you the closest
point on the curve. If you want to find the closest point on the bezier to a
given point, that's a slightly different problem (for a quadratic bezier it
amounts to solving a cubic equation)

Best
Danny

___
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] WhITE SNOW and Seven Dwarf - MAth Problems!

2007-04-26 Thread Danny Kodicek
 
> onEnterFrame/setInterval function is just to give spreading 
> effect to the app. 
>   as I mention earlier, using for loop doesnt't let any 
> animation play before loop ends. 
>   the real problem is only about the SEQUENCE-PATTERN. 

I got that. Check my code again and you'll see what it's doing: it's running
seven iterations in each frame, which should give you the effect you're
looking for.

Danny

___
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: Re[2]: [Flashcoders] Clear Set Interval Q:

2007-04-25 Thread Danny Kodicek
 > > Is a new intervalID always one greater than the most recent 
> intervalID?
> 
> AFAIK, yes.
> 
> > That is, will this always work to ensure you only ever have one 
> > interval running at a time?
> 
> Again, AFAIK, yes.. but at the same time it limits your to 
> only ever have one interval, no matter where.
> 
> For instance you won't be able to have 2 instances of the 
> same class run an interval at the same time, which might not 
> be what you're after.
> 
> If you want to manage intervals better than the built in way 
> (which is non-existant), google for setInterval manager and 
> I'm sure something useful will turn up.
> 
> Here's one I just found:
> http://www.ny-dev.com/forums/f184/interval-manager-552/

As a general rule, I don't use them at all, but I was just interested to
find a solution that didn't involve having to keep track of all intervals in
use. When working in Director, I've in the past wrapped timeout objects (the
Lingo equivalent of intervals) in my own objects to improve the
functionality, and that's probably what I'd do in Flash too if I were to use
them.

Danny

___
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: Re[2]: [Flashcoders] Clear Set Interval Q:

2007-04-25 Thread Danny Kodicek
 > 
> HG> So once you create a new interval with the same name you 
> will lose 
> HG> the path of the original?
> 
> An interval has no name, it has a numeric ID - what has a 
> name is the variable (or more variables if you want) where 
> you store this ID. And yes, if you doesn't care about storing 
> the ID (e.g. you overwrite it), you will lose information 
> which is required for clearing a specific interval.

Is a new intervalID always one greater than the most recent intervalID? That
is, will this always work to ensure you only ever have one interval running
at a time?

clearInterval(setInterval(this, "something", 1000) - 1)

Danny

___
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] WhITE SNOW and Seven Dwarf - MAth Problems!

2007-04-24 Thread Danny Kodicek
 

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf 
> Of Erich Erlangga
> Sent: 24 April 2007 14:27
> To: flashcoders@chattyfig.figleaf.com
> Subject: [Flashcoders] WhITE SNOW and Seven Dwarf - MAth Problems!


>   //run 7 times faster for attaching symbol in the library
> //(depends on how many people count)
> var a = 1;
> var b = 2;
> var c = 3;
> var d = 4;
> var e = 5;
> var f = 6;
> var g = 7;
> trace("first Number = " + a + " - " + b + " - " + c + " - " + 
> d + " - " + e + " - " + f + " - " + g);
> trace("Next Number =" + newline);
> _root.onEnterFrame = function(){
>  
>  a +=7;
>  b +=7;
>  c +=7;
>  d +=7;
>  e +=7;
>  f +=7;
>  g +=7;
>  
>  trace(a + " - " + b + " - " + c + " - " + d + " - " + e + " 
> - " + f + " - " + g);
>if (g == 70){
>   delete _root.onEnterFrame ;
>  }
>  
> }

Yes, that does look a bit odd. How about something like:

var tIndex = 1
_root.onEnterFrame = function() {
for (var i=0; i<7 i++) {
trace(tIndex++) 
}
if (tIndex == 70) { 
delete _root.onEnterFrame 
}
};

Danny

___
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] Little annoying AS editor question

2007-04-18 Thread Danny Kodicek
This is a small and silly question, but:

Is there any way to persuade the AS editor's automatic indent function not
to turn something like this:

myArray = [
[1,2,3],
[4,5,6],
[7,8,9]]

into: 

myArray = [1,2,3],[4,5,6],[7,8,9]]?

And yes, I know everyone prefers to use an external editor, but sometimes
it's less convenient (particularly when using the debugger)

Danny


___
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] setNewTextFormat

2007-04-17 Thread Danny Kodicek
 > What do you want to achieve, Danny?
> 
> 
> AFAIK setNewTextFormat is meant for user entered text, like 
> mentioned in the LiveDocs, which works well for me.
> 
> public setNewTextFormat(tf:TextFormat) : Void
> 
> Sets the default new text format of a text field. The default 
> new text format is the new text format used for newly 
> inserted text such as text inserted with the replaceSel() 
> method or text entered by a user.

What I want to be able to do is to change the text dynamically, and have the
new text come in with the same format as what's already there. For some
reason, this never seems to work reliably. Right now I'm writing a text
layout system which entails writing successive words to a field and testing
its height; at the moment, after each insertion I have to run setTextFormat
again, which seems very wasteful to me.

Danny

___
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] setNewTextFormat

2007-04-17 Thread Danny Kodicek

Hopefully a quickie:

Am I the only person that can never get setNewTextFormat to work? When I
change the text of a field, I always seem to have to run setTextFormat, even
if I've setNewTextFormat to the format I want. Is there some foolproof
system for getting this working without having to keep running setTextFormat
over and over again?

Danny

___
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] [semi-OT] - Preventing Software Piracy

2007-04-17 Thread Danny Kodicek
 
> Hi Nik,
> 
> I have done research for my dad a while ago, and I came to 
> the conclusion that it wasn't worth the effort $$$ wise.
> > Not sure whether that is applicable to your project, Pete, but has 
> > anyone ever used dongle (i.e. hardware) protection for 
> their projects?
> > I am currently testing out HASP from Aladdin, and does the 
> job so far 
> > (have not come very far yet in testing though).
> Yes, the problem with dongles is that it's quite hard to 
> implement, right.
> Especially, I would like to advice you not take any of the 
> included examples or even consider build on top of it. The 
> examples are weak. Please rent some person who is fully into 
> the dongle and encryption. If not, it will be lost money.
> 
> > What do you guys think about this kind of protection? Why isn't it 
> > used more often?
> Because it's a big investment to implement.

Absolutely - distribution costs, particularly, especially as each dongle has
to be unique. We've decided against using them for this reason.

I think there are also cultural differences, though. Some of our
international partners insist that dongle protection is the most common form
in their countries. A lot depends on reliability of internet access for
systems based on online activation (the only other method that seems
genuinely secure). 

Danny

___
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] flash and Arabic

2007-04-16 Thread Danny Kodicek
 > We tried the following:
> (we're embedding fonts in all cases, also we don't have 
> require any input fields...we're just displaying Arabic)

If you don't mind poor antialiasing, you could try not embedding the font -
this fixes all the problems you mention, for dynamic text.
> 
> -Copied Arabic text into a static text field...flash actually  
> reverses the characters.  So we copied reversed text a static 
> field.   
> Then when we published, it seems that the characters were not 
> being displayed correctly.  An arabic reader took a look at 
> it and told us  
> that the arabic characters didn't connect to each other correctly!   
> It's as if you took English script characters and broke them apart!

This quite surprises me, I'd have thought static would work fine. You could
try breaking apart the text once you've pasted it in, this should stop Flash
messing about with it.

> 
> We then tried a few more experiments...
> - copy and pasted Arabic text (normal order) into a dynamic 
> field...flash flipped it.  But when you publish it for Player 
> 8, the order of the text is correct, but the characters 
> looked disjointed again.
> 
> -We published it for Player 7 and this time everything looked 
> perfect.  The order of the text was correct and the 
> characters looked connected!!!
> 
> We basically have all the text assets in a separate .swf 
> (published for Player 7) and we're using it as a runtime 
> shared library.  Our main app is published as Player 8.
> 
> Has anyone else seen this?  Am I not doing something right 
> here? I'm shocked that support for Arabic (and I'm assuming other RTL
> languages) took a step backwards from Player 7 to Player 8.  
> I wonder what it is in Player 9.

Arabic is different from other RTL scripts (well, Hebrew anyway, which is
the only other one I know about) in that it's cursive. Hebrew doesn't suffer
from this complication, so all you have to worry about is bidirectionality. 

All the problems you give, especially variations across Flash versions,
browsers, operating systems etc, were why we ended up going down the
'complete control' route. My system does the whole thing manually, including
BiDi, cursive variations, ligatures and line breaking. It's not easy,
although there was a certain satisfaction in it :)

Danny

___
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] Re : memory issue

2007-04-16 Thread Danny Kodicek
 > Hi Friends,
> 
> I have developed the following script for scrolling 
> dynamically loaded content in the movie clip. 
> 
> The script is working fine. I just wanted to know is it 
> consuming lot of memory? Because when I load this movie onto 
> another movie. The first movie become slower.

Yes: you're doing an awful lot of createEmptyMovieClips:

> leftmenu_downbtn.onRollOver = function(){
>   scrollingspeed = 4;
>   leftscrollup=true;
>   leftscrolling_fn();
> }

> function leftscrolling_fn(){
>   var test =
> this.createEmptyMovieClip("test",this.getNextHighestDepth());
...
> }

Looks to me like you should move the creation of your test movieClip out of
the leftscrolling_fn function. 

Best
Danny

___
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] flash and Arabic

2007-04-16 Thread Danny Kodicek
 
> Thank you very much, Danny,
> 
> 
> Yes I thought that this post sank without a trace, lucky you saw it!
> 
> Fro the moment I jsut needed to know if there were any 
> issues, as I am tendering for an English course DVD that will 
> be sold in the Middle East.
> 
> Do I remember seeing your name on Director forums a long time ago?

You'll still see it on some of them :) I work on a big Flash-in-Director
project, so I encounter some of the worst of both worlds...

Danny

___
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] flash and Arabic

2007-04-16 Thread Danny Kodicek
 > HI,
> 
> It now transpires that the project I am quoting for needs 
> much of it done in Arabic. As it is my first multi language 
> project in Flash are there any issues with that in Flash (I 
> could write an encyclopedia full about Director and its 
> characater set issues)

Just got back from holiday and noticed this post which doesn't seem to have
had any replies.

Arabic in Flash is possible but tricky. Exactly how tricky depends on what
exactly you need to do. Just putting static Arabic text on screen is easy -
no different from Roman. Dynamic text is essentially okay, but you need to
watch out for RTL and Bidirectional issues. One major issue is that Flash
behaves differently for embedded and non-embedded fonts. Text rendered using
non-embedded fonts uses the OS-level text renderer, and so renders the text
using the standard Bidirectional algorithm. For single-line text this is
perfect (although we didn't test for a very wide range of OS's and browsers
- I suspect there might be some niggles on various combinations); for
multiple-line text you'll find that line breaks do not get added correctly
(words get broken half-way across) so you'll need to add your line breaks
directly into the dynamic text. Text rendered using embedded fonts does not
render correctly: it has the same line-break issues as before, but also it
renders LTR and fails to correctly interpret the Arabic characters into
their cursive variants (that is, join them correctly to give the
'handwritten' style that Arabic text should have). There are ways around
this, including some code libraries (check out FlashRTL). Personally, I
prefer this option as you're in more control - I hate leaving things to the
OS unless I absolutely have to! 

Of course, the above also depends on the *source* of your dynamic text: if
you're in complete control, you can store the text directly as the
characters that will appear on-screen. But if it's coming from something
like an external XML file or some other data source, you'll need to consider
these issues.

If you want input text, you're in a different kettle of crustaceans. We
managed to solve it, but it was a big job. There aren't currently any
available commercial solutions to this, but hopefully as soon as I'm
finished with my enormous globalisation job that's taken me the best part of
a year, we'll be releasing my solution in some form.

Danny

___
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] Image resizer that maintains ratio

2007-03-26 Thread Danny Kodicek
 > Any examples out there?
> 
> I've got as far as resizing a user supplied image and am 
> about to work on the ratio remaining fixed. Just thought I'd 
> throw this out there as I think it may be tricky.

How are they resizing? Which bit is tricky? Maintaining an aspect ratio
isn't too hard - you're just losing a degree of freedom from the user input.


Danny

___
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] Test

2007-03-23 Thread Danny Kodicek
 
> Is this delivered???

'ello

D

___
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] Using JSFL with AS files

2007-03-23 Thread Danny Kodicek
 > What do you mean specifically?

I mean editing AS with JSFL. I'm getting frustrated with not being able to
do a search and replace on multiple files, so I was going to write a tool to
do it with JSFL - unfortunately, it seems only to work with FLA files, not
AS.

Danny

___
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] Compiling with self-reference

2007-03-22 Thread Danny Kodicek
 
> Danny Kodicek wrote:
> > It's a shame: My object structure has a bunch of objects in a tree 
> > structure, all of which inherit the same base class. I'd 
> like them all 
> > to have a reference to the top-level node object, but I 
> have to refer 
> > to it as an Object instead of its actual class name because 
> otherwise 
> > it can't compile.
> >   
> You are mixing Classes and Instances. Classes inherit 
> properties and methods from other classes.
> How the instances are linked together at execution time is 
> another matter.

Well, not really. I may use the words 'class' and 'object' interchangeably
on occasion, but I'm quite aware of the distinction. Classes have
properties, instances give those properties values, classes define the kinds
of data those values can take. 

I don't think my example is that odd, really. It seems unnecessarily
restrictive not to be able to refer to a superclass within a subclass -
that's enforcing an arbitrary design principle.

Danny

___
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] Compiling with self-reference

2007-03-22 Thread Danny Kodicek
 

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf 
> Of Hans Wichman
> Sent: 22 March 2007 12:39
> To: flashcoders@chattyfig.figleaf.com
> Subject: Re: [Flashcoders] Compiling with self-reference
> Importance: High
> 
> Hi,
> this
> class Clarss {
>var pRoot:Clarss2
>function Clarss() {
>}
> }
> class Clarss2 extends Clarss {
>function Clarss2() {
>}
> }
> 
> looks like a design error to me. One of the reasons you would 
> use inheritance is polymorphism, and reducing complexity. A 
> super class having to know the type of its subclasses is not 
> good practice. Why not keep the reference pRoot:Clarss? You 
> can stick any subclass in there.

It depends on the circumstances. My main reason for using inheritance is
code reuse: putting common code into ancestors. In my case, I'm not writing
objects for reuse elsewhere. So it seems pretty reasonable to me that all my
objects know about all the other objects. Here's a simplified example of the
structure I'm trying to create:

RootElement extends Element
SimpleBlock extends BlockElement extends Element
TextItem extends ItemElement extends Element

the Element object has a pChildren:Array (empty for items) and
pParent:Element (undefined for Root) property, creating a tree structure.
Each element also has a direct reference pRoot:RootElement to the tree root
(this is the bit that doesn't work).

I think this makes good sense. I could shore it up by adding an additional
layer:

RootElement extends Element
SimpleBlock extends BlockElement extends ChildElement extends Element
TextItem extends ItemElement extends ChildElement extends Element

Here, ChildElement is the one that has the pRoot property, eliminating the
circular reference. But it seems a bit silly to have to add an empty class
just for the sake of a single property.

Danny

___
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] Using JSFL with AS files

2007-03-22 Thread Danny Kodicek
Is there any way to do it? (And yes, I know I'd be better off with an
external editor, but sometimes it's easiest just to work in the IDE). 

Danny

___
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 extending inherited function

2007-03-22 Thread Danny Kodicek
 
> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf 
> Of Mark Winterhalder
> Sent: 21 March 2007 23:41
> To: flashcoders@chattyfig.figleaf.com
> Subject: Re: [Flashcoders] Problem extending inherited function
> Importance: High
> 



Mark, thank you so much for this, it's *exactly* the kind of thing I was
looking for. By far the clearest explanation of how inheritcance works in
Flash that I've seen. Now I can go back to doing what I was doing, but with
a *much* clearer idea of why things do or don't work.

Best
Danny

___
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] Compiling with self-reference

2007-03-22 Thread Danny Kodicek
Slightly complicated and not terribly important but annoying:

It's possible for a class to compile while self-referring:

class Clarss {
var pParent:Clarss;
function Clarss(tParent:Clarss) {
if (tParent != undefined) {
pParent = tParent;
}
}
}

This compiles fine. But with inheritance this no longer works:

class Clarss {
var pRoot:Clarss2
function Clarss() {
}
}
class Clarss2 extends Clarss {
function Clarss2() {
}
}

Now the compiler gets confused by the circular reference and tells me
"**Error** C:\...Clarss.as: Line 1: The name of this class, 'Clarss',
conflicts with the name of another class that was loaded, 'Clarss'."


It's a shame: My object structure has a bunch of objects in a tree
structure, all of which inherit the same base class. I'd like them all to
have a reference to the top-level node object, but I have to refer to it as
an Object instead of its actual class name because otherwise it can't
compile.

Danny

___
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] Anyway way to capture a SWF as a bitmap?

2007-03-21 Thread Danny Kodicek
 > Anyone know if there's a way to draw the contents of a SWF to 
> a Bitmap/BitmapData object within Flash?
> 
> I have a SWF that involves lots of complex rendering steps 
> and I want to be export it as a bitmap.  The export part 
> should be fine (using a server to actually save the file) if 
> I can figure out how to get it into a BitmapData object so I 
> can call getPixels() on it.

Can't you just use BitmapData.draw()?

Danny

___
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 extending inherited function

2007-03-21 Thread Danny Kodicek
 > The way you had your code, the Child class will never receive 
> the killingFocus call. Add a Delegate within the Mother Class 
> to put the onKillFocus event into scope with Child...
> 
> import mx.utils.Delegate;
> 
> class Mother extends MovieClip {
> public var txt:TextField;
>
> public function Mother() {
> //this.onPress = killingFocus;
> this.txt.onKillFocus = Delegate.create(this, killingFocus);
> }
>
> public function killingFocus():Void {
> trace("testFunc in mother");
> }
>
> }

Hmm - this seems to go against the stuff we've been talking about recently
(see 'super and this' thread) where people have been saying that inherited
classes are essentially wrapped into one. This is an example where the
ancestor is being treated as an object in its own right. If inheritance
worked the way people described in the previous thread, it ought not to be
possible for a command to bypass the Child class and go straight to the
Mother.

Danny

___
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] Create an object by name

2007-03-21 Thread Danny Kodicek
 > >> Might be interesting to know why you need to do this at all.
> >> 
> >
> > I'm using an XML document to create a file. Without going into 
> > details, each node of the XML is to be turned into an 
> object, based on the kind of node.
> > So for example:
> >
> > 
> >
> > This would become two objects, one an instance of 
> MyBigClass, one an 
> > instance of MySmallClass. In an old version of this, each one was a 
> > MovieClip with the appropriate linkage name. Now I'm trying 
> to do it 
> > more flexibly with objects (so that in particular, each object type 
> > can inherit a standard class, and so that I don't have to have a 
> > separate movieClip for each object type).
> >
> > Danny
> >
> >   
> Why would you not have 1 class with 2 properties "type" and "size"?
> What is different between the 2 items that requires different 
> classes? 
> The properties are the same. What does Big do that Small does not do?

Loads of things (remember, 'big' and 'small' are just examples here).
They're completely different objects. For example, one might refer to a bit
of text, another to a picture, etc. If I put it all into one class, I'd have
to fill it with Ifs and Switchs, which is what I'm trying to avoid.

(Btw, I was out of communication yesterday due to a break-in at our office,
so apologies to those people who sent replies that I didn't respond to)

Best
Danny

___
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] Super and this

2007-03-19 Thread Danny Kodicek
 > I was simply suggesting that using the right words would make 
> things clearer. Danny is right in a sense.
> Ron
> 
> Karina Steffens wrote:
> > Danny, I think what Ron means is, you don't instantiate the class 
> > _and_ the super class, as you would with Director.
> >
> > As you know (and for anyone that isn't familiar with it), 
> in Director 
> > the "ancestor" property is an instance of the superclass, residing 
> > within an instance of the subclass (a bit like a Russian 
> Doll!) - but 
> > in Flash you don't get two instances within each other, but just a 
> > single hybrid of all the classes in the inheritance chain.
> >
> > To be honest, I'm not really sure what is better. Certainly the 
> > Director way is a lot more flexible - you can generate and swap 
> > ancestors on the fly, which I think is pretty cool, a bit 
> like inheritance via composition.

What I like about the Lingo model is the simplicity that every object is a
clear 'thing' that can be seen and inspected. There's a certain elegance to
the ECMA system where *everything* is an object, but you lose the sense of
distinction between objects, properties and methods that you have in Lingo.
Using this particular issue as an example, what exactly *is* 'super'? It's
not an object in the same sense that our instantiated class is, it's a kind
of hidden layer of the class.

I'm not saying one system is better or the other (I started with Lingo, so
I'm more comfortable with it, but I like both).

Danny

___
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


  1   2   3   4   5   >