Advertisement

04.08.2008 at 08:58AM PDT, ID: 23305141
[x]
Attachment Details

Actionscript 2, Attaching function to Selection?

Asked by RDdice in Macromedia Flash

Tags: Adobe, Flash CS3 ActionScript 2

I'm trying to convert this function to ActionScript 2, it's in ActionScript 1. I'm getting the error:

There is no method with the name 'setSharedFont'.

Seems that Actionscript 2 doesn't like adding a new function to selection like ActionScript 1. Any Ideas, hints?

I'm thinking it could be a prototype or something but i've never done it.Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
Selection.setSharedFont = function(id) {
	var text_field = eval(this.lastSelection[2]);
	var begin = this.lastSelection[0];
	var end = this.lastSelection[1];
	var loaded_fmt = font_mng[id];
	if (text_field) {
		text_field.setTextFormat(begin, end, loaded_fmt);
		text_field.setNewTextFormat(loaded_fmt);
		var selected = true;
	} else {
		text_field = _root.example_txt;
		text_field.setTextFormat(loaded_fmt);
		text_field.setNewTextFormat(loaded_fmt);
		var selected = false;
	}
	var selection_obj = this;
	var interval = setInterval(function () {
		clearInterval(interval);
		if (selected) {
			selection_obj.setFocus(text_field);
			selection_obj.setSelection(begin, end);
		}
	}, 0);
};
[+][-]04.08.2008 at 10:04AM PDT, ID: 21307300

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.08.2008 at 10:10AM PDT, ID: 21307368

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.08.2008 at 10:44AM PDT, ID: 21307696

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.08.2008 at 10:55AM PDT, ID: 21307802

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.08.2008 at 11:10AM PDT, ID: 21307917

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Macromedia Flash
Tags: Adobe, Flash CS3 ActionScript 2
Sign Up Now!
Solution Provided By: julianopolito
Participating Experts: 1
Solution Grade: A
 
 
[+][-]04.08.2008 at 11:32AM PDT, ID: 21308144

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.08.2008 at 11:59AM PDT, ID: 21308447

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.08.2008 at 12:45PM PDT, ID: 21308858

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.08.2008 at 01:09PM PDT, ID: 21309086

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.08.2008 at 01:55PM PDT, ID: 21309512

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.08.2008 at 02:18PM PDT, ID: 21309729

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.08.2008 at 03:01PM PDT, ID: 21310058

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628