Calling functions of a SWF embedded within an HTML Text Field...
I have a slideshow SWF of size 150px by 150px which changes
image every 5 seconds with the use of a timer, the SWF has a kill()
function which stops the timer.
In a larger content holding SWF I have a dynamically
generated textfield which populates its htmlText property via an
XML feed.
Within the htmlText I am inserting the slideshow SWF using
the <img> tags... It all works great until I proceed to
another page as there is no way to unload the slideshow SWF or call
its kill() function which eventually lags the system as I have
several heavy animations in the pages on ENTER_FRAMES.
Does anyone know how to unload a SWF or gain access to its
functions which is embedded within htmlText...
Thanks for replying :)
I tried that and using txt.getImageReference("idHere") I
casted it to a loader object however it wont let me then get access
to the SWFs functions...
I tried creating a sprite and using addChild() tried adding
the loader to the sprite but it gave me cohesion errors...
Any other help MUCH appreciated
Similar Messages
-
Text jumps after embedding font in dynamic text field!
Hi
this is driving me mad
Im using a standard font (Gotham rounded) within a dynamic text field. As soon as I embed the numerals within this text field the text lowers within the text field. Double clicking the field then renders the text higher up! It seems that the height it shows when I double click is the height it compiles at.
The other strange and annoying thing is that my colleague working on the same project is using the exact same font and same file but this doesnt happen to him and so the font redners out differently when he compiles!
Could anybody please help me sort this problem out as its reeeeally annoying
many thanks!
Nicknobody any ideas?!
-
Parent swf call function in Child swf not working
Hi all,
I'm having a problem with this and I just can't figure it out
:( (I've been trying different things and staring at it for hours
and I'm losing my mind...)
So I have a Parent swf that loads a Child swf (this goes
without any problems), but I want the Parent to call a function in
the child, now this is where it goes wrong...
The function the Parent has to call is named "lookupcar" and
needs to give the value "wagen" with it. The problem I think is
that the Parent wants to call the function but it still needs to
load (correct me if I'm wrong). Is there a way to check if the
Child swf is loaded completely before trying to call the function?
Could you give me an example of this please? Or any other
suggestions on what goes wrong?
Code in the Parent
root.inhoud.createEmptyMovieClip("thetext", "thetext",
this.getNextHighestDepth());
root.inhoud.thetext.loadMovie("uitrusting-wagenpark.swf");
root.inhoud.thetext.lookupcar(wagen);
Code in the Child
(the function lookupcar)
_global.lookupcar = function(carnr:String){
trace("LOOKUPCAR, with car nr: " + carnr);
Thanks in advance for all the help.Perfect....just to make sure i m taking care of it in a nice practical way....here is how i learned to access a file located in Child (researching other posts)
is this the way you recommend it?
(LoaderName.content as MovieClip).functionName(new Event("whatever"))
and in Child File we have
function functionName(e:Event)
i have seen other ways of calling a function in Child Swf , like using EmbedSWF and etc. wanna make sure which one is a better practice. Thanks -
I am attempting to use a non-standard font in an HTML dynamic textbox using the <font> tag. I have embedded this font using the textbox properties box and the fonts appear in the library. According to previous posts to this form, that should do it. But, my fonts are not appearing correctly. Any advice?
OK,
I have given up messing with stylesheets, trying display:
block, inline, different ways of formatting the XML, messing with
XML.ignoreWhiteSpace, and XML.prettyPrinting etc.
I went down the route of encodeURI, using a RegExp to strip
out all tabs, linefeeds and carriage returns. This now gives
consistent results for all situations, even embedded and none
embedded fonts.
e.g.
_text:String = TEXT FROM XML, HTML TEXT etc
var st:String = encodeURI(_text);
var pattern:RegExp = /(%09)+|(%0A)+|(%0D)+/g;
st = st.replace(pattern, "");
st = decodeURI(st);
YOUTEXTFIELD.htmlText = st;
The <p> tags still behave as a <br/> tag, but you
can add an extra <br/> to simulate a paragraph.
Here is the example again with the updates,
Hope this helps someone -
Embedding fonts in dynamic text fields
I am having trouble embedding a font in my Flash file. I have the font in my library. I have the text field selected to that font with the * next to it.
In my actions I have:
vid_title_txt.embedFonts = true;
If I set it to false instead, it shows a different font. But if it is set to true, nothing shows. I am running out of ideas what to look at to solve this issue. What am I doing wrong here?
Thank you very much for any help with this!I am in AS2.
I followed these steps.
Open the Library panel (Ctrl+L).
Add a font to your library - click the options menu in the upper right corner of the panel and select New Font from the menu.
In the Font Symbol Properties dialog box select the font, size and style that you want and give the font combination a name. Click OK to close the dialog box.
Right-click the font symbol in the library and select Linkage from the contextual menu.
In the Linkage Properties dialog box, click the Export for ActionScript button to enable both the Identifier and AS 2.0 Class text input fields. Leave the default Identifier value and click OK to close the dialog box.
Select the text tool from the Tools panel and draw a dynamic text field on the Stage.
Give the text field an instance name of "my_txt". In the Font menu select the symbol name you gave the embedded font earlier. You should see a little asterisk (*) beside the name.
In the Property inspector set the font size and style to match those in the Font Symbol Properties dialog box earlier.
Open the Actions Panel and add the following code to Frame 1 of your Flash document:
my_txt.embedFonts = true;
my_txt._rotation = 15;
my_txt._alpha = 10; -
How can I call functions from a SWF loaded in to another SWF?
Hi there,
Please excuse my ignorance, I am very new to actionscript and flash.
I have 2 SWF's - a.swf and b.swf.
I load b.swf into a.swf with the following code:
var swfLoader:MovieClipLoader = new MovieClipLoader();
swfLoader.loadClip("b.swf", container_mc);
Now in b.swf, I have a function as follows:
public function sendData(){
trace("I ran the function!");
So I have done a lot of reading, from what I can tell I should be able to run the sendData() function from the code in a.swf, by typing:
container_mc.sendData();
but its not working. What am I doing wrong?
Thanks in advance,
AdamThanks heaps mate, after a bit of trial and error it works! Here is the code that I added:
var loadingListener:Object = new Object();
swfLoader.addListener(loadingListener);
loadingListener.onLoadStart = function(container:MovieClip):Void {
trace("The MovieClip "+container+" started loading");
loadingListener.onLoadInit = function(container:MovieClip):Void
trace("The MovieClip " + container + " has been initialized");
container_mc.test();
Marked your answer as correct :-)
Thanks again, I really appreciate your help.
Cheers
Adam -
Is it possible to create different font styles within the same text field?
The form I am creating is getting really complex because when different fields require different font treatments (bold, italic, different font size, different font) I have to create a seperate text box and get it to align with the others. This wouldn't be an issue in most cases but this form is really detailed and has many text boxes. Before I stuggle too much longer on it, I thought I would check and see if there is a way to make them all in the same text field. If not, perhaps I am trying to use Acrobat for something it is not meant for. Any recommendations on other programs I could use? Thanks
Thank you try76. I'm not sure if I did it correctly. As soon as I tick the Rich Text Formatting box it automatically changes the appearance of the text in the field (Helvetica Light to something like Helvetica Heavy) I can't seem to get the font back to Helvetica light or change the font size while the Rich Text Formatting box is ticked.
-
Call to PL/SQL Stored Procedure in the HTML expression field
Hi,
I need to display an image in a report based on the value of the underlying field. (Y/N)
I created a solution based on http://www.dba-oracle.com/t_easy_html_db_display_image_html_expression.htm
Unfortunately this does not work for me. The PL/SQL written in the HTML expression field is not being executed. The result is something like : <img src="PKG_IMAGES.display_YN_checkmark_image?p_image=Y">
What am I missing?
Tx for your help.kcaluwae wrote:
Hi,
I need to display an image in a report based on the value of the underlying field. (Y/N)
I created a solution based on http://www.dba-oracle.com/t_easy_html_db_display_image_html_expression.htm
Unfortunately this does not work for me. The PL/SQL written in the HTML expression field is not being executed. The result is something like : <img src="PKG_IMAGES.display_YN_checkmark_image?p_image=Y">
What am I missing?Ensure that the Display As Column Attribute for the report column is Standard Report Column.
However, the linked article appears to be very out of date. If using APEX 3.1 or later, see About BLOB Support in Forms and Reports for a better alternative.
There's an OBE tutorial that followed the introduction of declarative BLOB support in 3.1 as well. (That might be an earlier version but it is still relevant to APEX 4.x.) -
IPhone: Sending a picture as an attachment, not embedded within the email?
Hello Community,
Does anyone have a suggestion as to how to e-mail a picture from your iPhone, as an attachment? NOT embedded within the e-mail....?
My wife's e-mail client (school teacher) will not allow her to receive/view emails that have pictures embedded within the body text. She can only receive pictures if they are attached separately on the e-mail.
The only work-around I have found, is by installing the Google Mail app onto my iPhone. Google Mail will allow you to send pictures as attachments. But I do not prefer this. I would like to use the iPhone's native e-mail application.
Thanks,
BPTo follow up on this question, is there any way to receive *.tiff or *.jpg on an iPhone/iOS device in general as an attachment rather than imbedded in the email, and "open with" some other application, or save to an application store, like GoodReader does with say, *.pdf's?
-
hi, how do i call a function from the function module and use it accordinly? i need call the EDITOR_SYNTAX_CHECK from the FM and use it in my program to check abap syntax that users entered.
pls provide codes.
thanks. will reward if useful.thanks for all of ur replies.
I have a text editor that allows users to enter abap codes and when they clicked on the save button, the program will check the syntax they have entered and prompt them accordinly. how can i call the EDITOR_SYNTAX_CHECK fm and used it for my program?
below is my codes:
REPORT ZEVONNE_DYN.
TABLES: ZPROGRAM_TABLE.
DATA: ITAB_PROGRAM TYPE TABLE OF ZPROGRAM_TABLE WITH HEADER LINE.
DATA: CODE_EDITOR_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
CODE_EDITOR TYPE REF TO CL_GUI_TEXTEDIT.
DATA: WA_PROGRAM LIKE LINE OF ITAB_PROGRAM,
g_ok_code LIKE sy-ucomm, " return code from screen
g_repid LIKE sy-repid.
DATA: st_head TYPE thead,
i_tline TYPE STANDARD TABLE OF ZPROGRAM_TABLE,
wa_tline TYPE ZPROGRAM_TABLE.
TYPES: BEGIN OF DYN_CODE,
LINE(255),
END OF DYN_CODE.
DATA: DYN_CODE_TABLE TYPE TABLE OF DYN_CODE,
wa_lv LIKE LINE OF DYN_CODE_TABLE.
CONSTANTS: CODE_EDITOR_LENGTH TYPE I VALUE 255.
DATA: BEGIN OF CODE_EDITOR_LINE OCCURS 0,
PROGRAM_CODE TYPE ZPROGRAM_TABLE-PROGRAM_CODE,
END OF CODE_EDITOR_LINE.
TYPES: BEGIN OF CODE_EDITOR_TABLE_LINE,
LINE(CODE_EDITOR_LENGTH) TYPE C,
END OF CODE_EDITOR_TABLE_LINE.
DATA: CODE_EDITOR_TABLE TYPE TABLE OF CODE_EDITOR_TABLE_LINE,
CODE_EDITOR_CONTENTS LIKE STANDARD TABLE OF LINE.
DATA: INSERT_COUNTER TYPE I, INSERT_VALUE(CODE_EDITOR_LENGTH) TYPE C,
GT_HEAD LIKE THEAD.
*ID
DATA l_number TYPE i.
DATA l_number2 TYPE i.
DATA: im_cpidentmax LIKE ZPROGRAM_TABLE-PROGRAM_ID.
*End ID
SELECT * INTO TABLE ITAB_PROGRAM FROM ZPROGRAM_TABLE.
START-OF-SELECTION.
CALL SCREEN 9000.
MODULE STATUS_9000 OUTPUT.
SET PF-STATUS 'SCREEN_9000'.
SET TITLEBAR 'TITLE_9000'.
IF CODE_EDITOR IS INITIAL.
CREATE OBJECT CODE_EDITOR_CONTAINER
EXPORTING
CONTAINER_NAME = 'GEN_CODE'
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5.
CREATE OBJECT CODE_EDITOR
EXPORTING
PARENT = CODE_EDITOR_CONTAINER
WORDWRAP_MODE =
CL_GUI_TEXTEDIT=>WORDWRAP_OFF
CL_GUI_TEXTEDIT=>WORDWRAP_AT_FIXED_POSITION
CL_GUI_TEXTEDIT=>WORDWRAP_AT_WINDOWBORDER
WORDWRAP_POSITION = CODE_EDITOR_LENGTH
WORDWRAP_TO_LINEBREAK_MODE = CL_GUI_TEXTEDIT=>TRUE.
ENDIF.
ENDMODULE. "STATUS_9002 OUTPUT
MODULE USER_COMMAND_9002 INPUT
MODULE USER_COMMAND_9000 INPUT.
CASE SY-UCOMM.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'SAVE'.
MESSAGE S000(ZMSG02).
WHEN 'LOAD'.
send table to control
CALL METHOD CODE_EDITOR->set_text_as_r3table
EXPORTING
table = DYN_CODE_TABLE
EXCEPTIONS
OTHERS = 1.
IF sy-subrc NE 0.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = g_repid
txt2 = space
txt1 = text-004.
ENDIF.
no flush here:
the automatic flush at the end of PBO does the job
ENDCASE.
ENDMODULE. "USER_COMMAND_9002 INPUT -
How to Load a SWF in Dynamically Loaded HTML
Hello,
I have a Flash movie with a multi-line text field that loads
HTML text. As per the below Macromedia documentation I have swfs as
images inside my HTML text.
I'm trying to find a way to pre-load these swfs - if I do
loadmovie to load the swf, when the html file is loaded will it
need to reload the swf from scratch or will it take my loaded
version? I'd love to show a "loading" message in the text as the
swf was loading but am unsure how to do this now that I have the
swf reference embedded in the html text.
Any ideas?
Thanks!
Julia
From the Macromedia documentation:
Image tag (<img>
The <img> tag lets you embed external JPEG files, SWF
files, and movie clips inside text fields. The <img> tag has
one required attribute, src, which specifies the path to a JPEG
file, a SWF file, or the linkage identifier of a movie clip symbol.Thanks - your answer is exactly what I was looking for.
I'm noticing that every swf I load via dynamic HTML is
distorted - is there a way to prevent this? I can set the width and
height of each swf in the HTML, which works ok, but then I run into
a problem when I try and have a component item (like an accordion)
included in the dynamic text field. It works properly, and the
framing is sized correctly, but the guts are still skewed. I
haven't been able to figure out why the swfs are being distorted in
the first place.
Any ideas?
Thanks,
Julia -
Calling functions / setting variables in loaded SWF
You know how you can create a Movieclip object, add a
function or variable to it, then call that function or change that
variable from within the SWF that includes it? I wanna be able to
do that, only with SWFs that are loaded at run time.
My "main" SWF is simply a menu-type thing. The user clicks a
button in my MAIN.SWF, and the MAIN.SWF then loads the SWF that's
associated with that button, using the AS 3.0 prescribed
Loader()-URLRequest()-addChild() method that everyone always asks
about.
This works great. But now I've got some custom objects and
such (ie., not just strings) within my MAIN.SWF that I'd like to be
able to share with the loaded SWFs. Preferably, I'd like to use an
accessor-type function (ie.,
LoadedSWF.GiveMeTheCoolObject(MyCoolObject);), though at this point
I'm willing to hack into the object itself (ie.,
LoadedSWF.CoolObject.CoolField = MyCoolObject.CoolField;) if that's
what it takes.
I've tried just calling the functions and setting the fields,
but the AS 3.0 compiler doesn't care for that sort of nonsense on
it's generically-defined objects. Notice also that, at run time, a
call to LoadedSWF.hasOwnObject("GiveMeTheCoolObject") returns true.
So my big-brained colleagues, what's the magic?
In advance, thanks for the help!
ScottKglad,
quote:
Originally posted by:
kglad
from that error message it appears your function is expecting
a member of the MyCoolObject class, correct?
and MyCoolObject is not an instance of that class. so, you
need to fix that. ie, create a member of that class and use that
class member as the function parameter.
Heh, that's what the error message says all right. But the
object actually IS a MyCoolObject class object. I stared at this
thing for hours, and MyCoolObject IS an instance of that class. I
tried various casting combinations (including casting it to an
Object and passing that) but had no luck whatsoever.
So I googled this particular runtime error message ("Error
#1034: Type Coercion failed: cannot convert ") and found a ton of
links to other people having a similar issue. Typically, the
problem was just as you said, someone passing a button as a string,
that kinda thing. But one guy had a problem with an object he
derived from the Event class. After hours spent trying to get it to
work, he tried overriding the base class' clone() method and got it
to work:
http://www.asserttrue.com/articles/2006/10/14/custom-events-in-actionscript-3-0
As for my project, I took a long hard look at the overall
architecture of my project and decided that it was best if all the
"real work" took place in the MAIN.SWF file. This approach would
solve a couple of other problems, and it just makes sense in a
"separate the display from the data" mentality.
So (and this is the interesting part) I changed the API for
the LOADED.SWF to accept String pairs (ie.,
LoadedSWF.AddToDisplay(Name:String, Data:String) ) instead of
accepting MyCoolObj. Ran it, and Viola, now we're working without
any run time exceptions. After that glorious moment, I created a
couple of other APIs that just accepted base classes (one an int
type, the other a function type) and was happily on my way.
From this, I gather that passing non-base class (ie, derived
class) objects to loaded MovieClips via custom function APIs is...
maybe not as straightforward as we'd expect. In the grand scheme of
things though, not a big deal: As far as I'm concerned AS3 rocks.
Again Kglad, thanks for all the help: Your input on how to do
this was the big push that I needed to get over the last technical
hurdle of this project.
To those who are reading this topic for the "how do I call
functions and/or set variables in a loaded SWF?"
The short answer is to cast the loaded SWF's content object
as a MovieClip and then call the function or alter the variable:
//Load the SWF (you've seen this code a million times)
var LoadedSWFObj:Loader = new Loader();
var MyURL:URLRequest = new URLRequest("LoadThisSWF.SWF");
LoadedSWFObj.load(MyURL);
//This is within your Event.COMPLETE handler:
//Cast it as a MovieClip object and work with that.
var LoadedSWF:MovieClip = LoadedSWFObj.content as MovieClip;
// or another way to cast it is:
var LoadedSWF:MovieClip = MovieClip(LoadedSWFObj.content);
//Call yer function:
LoadedSWF.CallMe(); -
Hi,
i´ve developed an RFC FM and within this FM i use
CALL FUNCTION '
NUMBER_GET_NEXT'
in order to get a sequential number each time the FM is called.
When this RFC FM is called from XI
i get exception 1 (INTERVAL_NOT_FOUND)
Why is this happening?
How can i solve this problem?
Best regards.Hi,
i just do this:
DATA: l_number(15) TYPE C.
IF l_number IS INITIAL.
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
NR_RANGE_NR = '00'
OBJECT = 'ZVLBSOLICI'
IMPORTING
NUMBER = l_number
EXCEPTIONS
INTERVAL_NOT_FOUND = 1
NUMBER_RANGE_NOT_INTERN = 2
OBJECT_NOT_FOUND = 3
QUANTITY_IS_0 = 4
QUANTITY_IS_NOT_1 = 5
INTERVAL_OVERFLOW = 6
BUFFER_OVERFLOW = 7
OTHERS = 8.
ENDIF.
Best regards. -
How? Flex pass variables or call function in SWF
Dear All:
I am new in Flex.
But I stuck with a problem for weeks.
I wish to communication between Flex and Flash(swf).
I tried to pass variable from Flex to Swf. (Call function in Swf also pass variables)
I did some tourital on google by using SWFLoader, which works fine.
BUT the AS code in SWF must in MAIN FRAME.
I need put my AS code by using DOCUMENT CLASS.
BUT when I using Document class, the method is not working.
The flex cannot find function in Flash.
PS.I already set main.as class as public
Hope some one can give some hint.
I really get a huge headache.
Many thanks,
HenrymyIP wrote:
> or perhaps more ideal;
>
> for(var sVar in flashVars)
> {
> i++;
> //var mcName = sVar.substr(0,3);
>
> // create the MCs:
> duplicateMovieClip(_root.testBut,"medium"+sVar,i);
> _root["medium"+sVar].testText.text=sVar;
> _root["medium"+sVar].mcName = sVar.substr(0,3);
>
>
> // assign the function to each created MC:
> _root["medium"+sVar].onRelease = function()
> {
> trace(this.mcName)
> _root[mcName]._x=0;
> }
> }
>
thanks but this does not work.
I think that the problem is that the variables defined in the
for loop do not exist in the scope of
the function.
when the MC is clicked, and the onRelease function says:
_root[mcName]._x=0;
the variable "mcName" is empty.
seb ( [email protected])
http://webtrans1.com | high-end web
design
An Ingenious WebSite Builder:
http://sitelander.com -
Calling a function in another .swf, possible?
I have two movies... main.swf and content.swf, and I'm trying to call a function in my main.swf from my content.swf. Here is the code..
//function in main.swf
function appear (event:MouseEvent):void{
TweenLite.to(title1, 1, {autoAlpha:1, overwrite:false});
//try to call from loaded content.swf
close_btn.addEventListener(MouseEvent.CLICK, btnClick);
function btnClick(event:MouseEvent):void {
MovieClip(parent.parent).appear();
I got an error message as soon as i click on close_btn. It says appear() is not a property or method.
Would someone help me out on this please?
Thank you very much.I think it is not a good OOP design. It is much better to design applications in a such way that they do not depend on placements (especially parents). Particularly, if your application acts as a component that can be consumed in some unpredictable fashion. Theoretically, if you write something that will become a stand alone swf - it should perform with no errors both as stand-alone and when loaded.
You are already dealing with the results of this design flow. The most cumbersome and inflexible aspect of your approach is to capture parents chain.
In your case I would totally dissociate you loaded swf from the placement and couple it with the parent via events.
The best way would be for your loaded swf to dispatch and event that is consequently captured by it parent(s) no matter, again, where it is placed. For instance it can be done the following way:
// in your top movie
// say the loaded swf is set to a variable:
import flash.display.MovieClip;
import flash.events.Event;
var loadedSWF:MovieClip;
// your loading routine
// once it is loaded
// note that capture is set to true so that
// no matter depth of event origination
// it will be captured by this scope
loadedSWF.addEventListener("close", onCloseClick, true);
function onCloseClick(e:Event):void {
// do whatever
// IN YOUR LOADED SWF
close_btn.addEventListener(MouseEvent.CLICK, btnClick);
function btnClick(event:MouseEvent):void {
// dispatch event
dispatchEvent(new Event("close"));
Maybe you are looking for
-
When I plug my ipod shuffle into my usb port, it no longer shows as a "device" over to the left. This makes it impossible to to transfer a new playlist to my ipod. Any suggestions?
-
How can I know if my new internal hd for macbook pro is compatible?
I have been trying to upgrade my internal HD for macbook pro early 2008 2.4 and have been having a hard time getting it to boot. Problems with both WD and Seagate. I am wondering if the problem is with Mavericks. I got a good back up from Time Mac
-
Hello, I have created a simple model class, controller class, and a view that was created using Scene Builder application. Though injection I've passed the model object to the controller and I'm able to handle events and call methods of the model. Th
-
Spoil national characters while migration
I ran into a bit problem: while migration from MS SQL to Oracle all national symbols were transformed to "?" character. Oracle was installed with two locale - American and Russian. Changing of current operatio system localization hasn't taken any eff
-
Catalyst 3750 24FS-S Initial Setup help please
First time with Cisco and with Fibre, so a double whammy! I would appreciate some help from the community from someone with experience setting up a 3750 24FS Switch I have WS-C3750-24FS-S fibre switch that I have inherited In good working order but f