Group: http://groups.google.com/group/bristol-flash-user-group/topics
- Interactive text question.... [10 Updates]
- Hello [3 Updates]
- BFUG meeting pre Flash on the Beach : 8th September 2011 : Harbourside No.1 Pub [2 Updates]
Sam <sam.mc...@gmail.com> Sep 09 03:08AM -0700 ^
Hello BFUG,
Very good to see a lot of you last night. Good times indeed.
I have a technical issue with an interaction coming up that I wondered
if anyone had any input on. Basically, it's a game where the user
needs to identify, and change, sections or words of text in paragraphs
of text by clicking on the offending items. The client needs to be
able to update and change the content and functionality themselves at
a later date so all content will be stored in xml. This cannot be done
in a quick and dirty way by putting invisible hotspots over a static
text field. I also cannot parse through the text and make mcs out of
each word and then layout the text dynamically that way.
I need to find a way of getting the coordinates of specific words or a
word, creating hotspots over those coordinates and then being able to
update the words with the correct or chosen versions. I also need to
empower the client to generate this functionality through the xml. Has
anyone any tips or advice on how to do this? Issues come to mind with
things like..... how would it work if the clickable phrase was cut in
half by a line break? How would I create the xml so that it's easy for
someone to designate functionality and choices within paragraphs of
text? And then..... how would I integrate the changes into that text
at the right places and then reupdate the hotspots for other
interactive sections of that text?
Thanks,
Sam
David James <da...@djgd.co.uk> Sep 09 11:31AM +0100 ^
Of the top of my head;
you split the text string usng textString.split(" ") or similar and create
movieclips out of every word, you can use the cumulitive width of all the
words to find ut where line breaks exist - for selecting which words would
be clickable you could use some other character to look for in the text
string like tubes: | or use xml tags
<string> text here <highlight> make this selectable </highlight> carry on
with text here</string>
barnaby menage <barn...@gmail.com> Sep 09 11:31AM +0100 ^
how about:
- putting a full stop in different colours e.g. red at start of word
and green at end
- saving the text area as bitmap data
- process the bitmap to get the x and y coords based on the colour values
- dynamically place movieclips hotspots based on that
best
barnaby
"s'unya" <sunya....@gmail.com> Sep 09 11:31AM +0100 ^
> For more options, visit this group at
> http://groups.google.com/group/bristol-flash-user-group?hl=en.
> Hi Sam,
You'll need a string of the text for ease of searching and indexing and
then you can get a Point of specific characters using
mytext.getCharBoundaries(myCharIndex);
Cheers
--
o
o o
O O O
o o O s´unya O o o
Aden Forshaw <aden.f...@gmail.com> Sep 09 11:39AM +0100 ^
And if you need to find the character under a give X/Y i.e. on mouse click,
then getCharIndexAtPoint should be your friend there.
Great to see so many there last night btw.
Laters, Aden
--
Skype: aden.forshaw
Mobile: 07595 152418
Ben Bath <ben.o...@googlemail.com> Sep 09 04:50AM -0700 ^
//how about this? does not account for words that run over two lines
though
import flash.text.TextField;
import flash.geom.Rectangle;
import flash.display.Sprite;
var tf:TextField = new TextField();
tf.width = 200;
tf.height = 100;
addChild(tf);
var text:String = "sdkfhj asdlfkjhasdf kjhsdfjasdf sdkjhsd sdkljhsdf
sadfkjhsdf sdf";
var lookup:String = "sdfjas";
tf.text = text;
var index:int = text.indexOf(lookup);
var rect:Rectangle;
var rect1:Rectangle = tf.getCharBoundaries(index);
var rect2:Rectangle = tf.getCharBoundaries(index+lookup.length-1);
rect = rect1.union(rect2);
var s:Sprite = new Sprite();
s.graphics.beginFill(0,.3);
s.graphics.drawRect(rect.x,rect.y,rect.width,rect.height);
addChild(s);
Ben Bath <ben.o...@googlemail.com> Sep 09 04:55AM -0700 ^
//how about this. Problem if word wraps. Also could use special chars
that are replaced to avoid duplicate matches in a String.
.
import flash.text.TextField;
import flash.geom.Rectangle;
import flash.display.Sprite;
var tf:TextField = new TextField();
tf.width = 200;
tf.height = 100;
addChild(tf);
var text:String = "sdkfhj asdlfkjhasdf kjhsdfjasdf sdkjhsd sdkljhsdf
sadfkjhsdf sdf";
var lookup:String = "sdfjas";
tf.text = text;
var index:int = text.indexOf(lookup);
var rect:Rectangle;
var rect1:Rectangle = tf.getCharBoundaries(index);
var rect2:Rectangle = tf.getCharBoundaries(index+lookup.length-1);
rect = rect1.union(rect2);
var s:Sprite = new Sprite();
s.graphics.beginFill(0,.3);
s.graphics.drawRect(rect.x,rect.y,rect.width,rect.height);
addChild(s);
"s'unya" <sunya....@gmail.com> Sep 09 02:14PM +0100 ^
> s.graphics.drawRect(rect.x,rect.y,rect.width,rect.height);
> addChild(s);
> --
Hi,
That is about it. To deal with wrapping words you could look at the index of
the start and end character of your search string to see if the y values has
changed. If they are then you will need to split your sprite.
Sorry no code; I'm a bit busy
--
o
o o
O O O
o o O s´unya O o o
Ben Bath <ben.o...@googlemail.com> Sep 09 06:29AM -0700 ^
//ok more like this then...
import flash.text.TextField;
import flash.geom.Rectangle;
import flash.display.Sprite;
import flash.display.BlendMode;
var tf:TextField = new TextField();
tf.wordWrap = true;
tf.width = 100;
tf.height = 300;
addChild(tf);
var text:String = "sdkfhj asdlfkjhasdf kjhsdfjasdf sdkjhsd sdkljhsdf
sadfkjhsdf sdf";
var lookup:String = "asdlfkjhasdf kjhsdfjasdf sdkjhsd sdkljhsdf s";
tf.text = text;
var index:int = text.indexOf(lookup);
var rect:Rectangle;
var rect1:Rectangle = tf.getCharBoundaries(index);
var rect2:Rectangle = tf.getCharBoundaries(index+lookup.length-1);
rect = rect1.union(rect2);
var s:Sprite = new Sprite();
addChild(s);
s.alpha = .4;
switch(true){
case rect1.y==rect2.y:
//single line
s.graphics.beginFill(1);
s.graphics.drawRect(rect.x,rect.y,rect.width,rect.height);
s.graphics.endFill();
break;
case rect1.bottom<rect2.y:
//more than two lines fill full width gap
rect = new Rectangle(tf.x,rect1.bottom,tf.width,rect2.top-
rect1.bottom);
s.graphics.beginFill(1);
s.graphics.drawRect(rect.x,rect.y,rect.width,rect.height);
s.graphics.endFill();
//NB no break statement
case rect1.bottom==rect2.y:
//top and bottom rectangles
rect = rect1.union(new Rectangle(tf.x+tf.width-1,rect1.y,1,1));
s.graphics.beginFill(0);
s.graphics.drawRect(rect.x,rect.y,rect.width,rect.height);
s.graphics.endFill();
rect = rect2.union(new Rectangle(tf.x,rect2.y,1,1))
s.graphics.beginFill(0);
s.graphics.drawRect(rect.x,rect.y,rect.width,rect.height);
s.graphics.endFill();
break;
}
Sam <sam.mc...@gmail.com> Sep 09 06:50AM -0700 ^
Thanks everyone for your input, it is much appreciated and really helpful. I
have lots of solid direction now. I'm not going to get properly stuck into
until after FOTB so I'll let you know how it goes.
Cheers,
Sam
Topic: HelloGraham <gra...@sibdev.co.uk> Sep 09 04:17AM -0700 ^
Hello all,
Good to de-lurk and meet you last night.
I thought I'd tentatively venture my showreel for feedback... also I
am freelance and always interested in making new contacts.
http://www.graylo.net/showreel
Graham
Dave Cropley <dmcr...@gmail.com> Sep 09 12:24PM +0100 ^
Nice - great reel, really strong design work. skills ;) - dig the minimal
presentation as well, loves at bit of un-clutter does I.
Ace to meet you last night Graham, keep in touch!
All the best,
> bristol-flash-user...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/bristol-flash-user-group?hl=en.
--
*Dave Cropley*
+44 (0) 7977 546978
skype: dmcropley
LinkedIn <http://www.linkedin.com/in/davecropley>,
CV<http://dmcropleycv.wordpress.com/portfolio/>
, ArtBlog <http://dmcropley.wordpress.com/>,
Twitter<http://twitter.com/#!/dmcropley>
,
Facebook<http://www.facebook.com/pages/DMCropleyArt/204179702966404?sk=wall>
, Youtube <http://www.youtube.com/user/dmcropley>,
Flickr<http://www.flickr.com/photos/dmcropley/>
***
*
Graham <gra...@sibdev.co.uk> Sep 09 04:52AM -0700 ^
Thanks Dave!
David James <da...@djgd.co.uk> Sep 09 11:03AM +0100 ^
Great to catch up with everyone at Bfug (which seemed to be characterised by
the complete lack of any talk about flash itself)
We should have a debrief after for flash on the beach for all those
unfortunate enough not to be attending
David
Dave Cropley <dmcr...@gmail.com> Sep 09 11:11AM +0100 ^
--
Morning, you beat me to it!
^^ What he said. Great to see everyone again, and new faces to boot - which
is a big fat win.
I'd definitely be up for a post FOB meet so I can live my life vicariously
through others :D
I suppose I should add for those that I didn't meet - I'm back in the
freelance world as of last week so if you need a senior level flash animator
/ front end designer and all round nice bloke - check my folio site here,
I'd love to hear from you -> http://dmcropleycv.wordpress.com/portfolio/
Looking forward to seeing you all again soon,
All the best,
> bristol-flash-user...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/bristol-flash-user-group?hl=en.
--
*Dave Cropley*
+44 (0) 7977 546978
skype: dmcropley
LinkedIn <http://www.linkedin.com/in/davecropley>,
CV<http://dmcropleycv.wordpress.com/portfolio/>
, ArtBlog <http://dmcropley.wordpress.com/>,
Twitter<http://twitter.com/#!/dmcropley>
,
Facebook<http://www.facebook.com/pages/DMCropleyArt/204179702966404?sk=wall>
, Youtube <http://www.youtube.com/user/dmcropley>,
Flickr<http://www.flickr.com/photos/dmcropley/>
***
*
You received this message because you are subscribed to the Google Groups "Bristol Flash User Group" group.
To post to this group, send email to bristol-flas...@googlegroups.com.
To unsubscribe from this group, send email to bristol-flash-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/bristol-flash-user-group?hl=en.