Groups | Blog | Home
all groups > flash actionscript > march 2004 >

flash actionscript : asfunction help with components...


tgleaton
3/2/2004 9:52:19 PM
Hello,

I am trying to figure out how to asign text in a scrollPane component actions
to load other movies into different levels in my flash movie. Basically, I
have a scrollPane component. It has a lot of text in it. I want to be able to
have certain parts of the text act like buttons to call other movies on
different levels when pressed. I can do this using invisible buttons but
sometimes the buttons are not aligning up with the text. I was told asfunction
would be the way to go. I tried finding information on this but I have not had
much luck so far. Has anyone done this and know of any good tutorials or a
good way to explain this.

Thanks........tg
dk_says_hey
3/2/2004 10:17:53 PM
first off, i've never heard of asfunction, it probably doesn't exist. you can
get at the content of a scroll pane by 'ScrollPane.getScrollContent()' you
could put functions in the movie clip in scrollpane to line up the buttons.
Dave_090
3/2/2004 10:23:08 PM
I'm not sure if this will help:
not to sure what a scroll pane component is but if it is like a text field
then this should be somewhat accurate.

asfunction works with <a href> tags but instead of a hyperlink it can call a
function.

<a href="asfunction:function_name, +arguments">text here</a>

then you would have a function name, in this case function_name,

function function_name(){
createEmptyMoveClip("clip",1);
clip.loadMovie("movie.swf");
}

which would handle the loading of the movieclip.
You shouldn't need to pass any arguments unless you are loading the movies
from an array in which they have index value then you will need to do some
argument passing.

hope this helps.
Dave_090
3/2/2004 10:26:43 PM
hey I don't know why my text was deleted, but you can go to the actionscript dictionary to see how to use an asfunction method
a href="asfunction:function_name, +arguments" text close a
Laiverd.COM
3/3/2004 12:59:43 AM
check manual again; it DOES exist ;-)

John

--
----------------------------------------------------------------------------
-----------
RESOURCES
http://groups.google.com/advanced_group_search?hl=en&as_ugroup=*flash
----------------------------------------------------------------------------
-----------
TUTORIALS at
www.laiverd.com
Flash & PHP Emailform
Using textfiles in Flash
----------------------------------------------------------------------------
-----------

tgleaton
3/3/2004 1:39:49 AM
Yes, there is something called an "asfunction" and the "scrollPane" is a
component found in Mx just like the scrollBar. I have found some things on the
asfunction in the actionScript dictionary, just not exactly what I want it to
do. I also have a book "Flash MX Designer's ActionScript Reference" that has a
little bit about it but not in-depth enough for what I am trying to do.

Basically, when the movie with my scrollPane comes up I want to be able to use
asfunction to load another movie into the same level as the one which already
has the scrollPane component loaded into it. This involves using the
asfunction which looks something like this:

Hope this explains it a little better. I tried the following example but
could not get it to work.

Create a function on the main timeline something like this:



code:---------------------------------------------------------------------------
-----
jumpFrame = function(targetFrame) {
gotoAndStop(targetFrame);
};

--------------------------------------------------------------------------------

2. Ensure that "Render as HTML" is selected in the dynamic textfield
properties.

3. Use the "a href" HTML tag to create links that jump frames. For example:


code:---------------------------------------------------------------------------
-----
<A HREF=\"asfunction:jumpFrame,5 \">Click here to go to frame 5</A>";
Jack.
3/3/2004 3:00:10 PM
dk_says_hey says-
[quoted text, click to view]

TOTAL BS, read the help files

tgleaton, check this thread-


http://www.macromedia.com/cfusion/webforums/forum/messageview.cfm?catid=194&thre
adid=783051&highlight_key=y&keyword1=asfunction

hth
AddThis Social Bookmark Button