Embed movie clip in flex
Hey,
I have converted a avi file to an swf file with "MediaCoder".
My plan was to simply embed this movie clip into my flex application, which did not work for me. :-(
How can I embed the swf movie into flex AND play/stop the movie with buttons?
I tested the following code, but when I click on the stop button I get the error:
"TypeError: Error #1009: Der Zugriff auf eine Eigenschaft oder eine Methode eines null-Objektverweises ist nicht möglich."
Obviously there is a problem with that swf file because another swf file is working...
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" horizontalAlign="center" >
<mx:Panel width="500" height="336">
<mx:SWFLoader minHeight="300" minWidth="300" id="swfObj" source="@Embed('movie.swf')" creationComplete="init();" height="203" width="462"/>
<mx:Button click="stop();" label="stop">
</mx:Button>
</mx:Panel>
<mx:Script>
<![CDATA[
import flash.display.MovieClip;
public var mc:MovieClip = new MovieClip;
public function init():void {
mc = ( ( swfObj.content as MovieClip ).getChildAt(0) as Loader ).content as MovieClip;
public function stop():void
mc = ( ( swfObj.content as MovieClip ).getChildAt(0) as Loader ).content as MovieClip;
mc.gotoAndStop(20);
]]>
</mx:Script>
</mx:Application>
Actully I have two frame in movie clip(cs3). On mouse hover
it goes to second frame and on mouse out it comes to first frame.
Now when I am using this movie clip in flex and want to get the
click event on that movie clip it does not work at once. If I
remove the mouse hover and mouse out from movie clip the click
event works. But to get those mouse hover and mouse and in over
movie clip I had to write to many code.
However that mouse hover and mouse out by flex over movie
clip it takes time to get work.
Similar Messages
-
Working with movie clip in flex
I am using a movie clip with animation having 2 frames
developed in flash cs3 in flex. The movie clip has mouse hover and
mouse out animation. Now I am using the movie clip and want to make
a click event on the clip. But it does not work at one click. I
have to click more than once. Also When I remove that animation the
click event goes well.
Can I make a movie clip by flex?
or
How can I use that movie clip with animation developed in
flash cs3 and also click event work well.
Please help me.Actully I have two frame in movie clip(cs3). On mouse hover
it goes to second frame and on mouse out it comes to first frame.
Now when I am using this movie clip in flex and want to get the
click event on that movie clip it does not work at once. If I
remove the mouse hover and mouse out from movie clip the click
event works. But to get those mouse hover and mouse and in over
movie clip I had to write to many code.
However that mouse hover and mouse out by flex over movie
clip it takes time to get work. -
Accessing movie clip from flash swf file
I have the situation where in flash i created a simple
animated movie clip with few stop() commands on timeline. Movie
clip consists of simple animatio played on roll over and on roll
out which is controlled using actionscript. I loaded movie clip
into flash using [embed] tag but actionscript code is stripped,
there is no stop() action so movie clip loops continously. I guess
that's normal behaviour for embedded flash swf files but i would
like to know is there a way to still achieve that? Can i load swf
some other way with its actionscript and then control movie clip
from flex?You need the FLA's to open in Flash.
You could download the free trial of a flash decompiler
(www.sothink.com). The free trial won't give you actionscript, but
it will give you all of the art in the swf. -
Hi All,
I'm looking for some information on how to take an embedded
flash movie clip and control it through Flex. I want to be able to
manually move through the movie clip, select frames to display etc.
Any information pointing me in the right direction would be
greatly appreciated.
Thanks in advanceFor Flash SWF's:
Inside your componet/app def:
private var movie_clip:MovieClip;
private var myLoader:SWFLoader = new SWFLoader();
onInit() {
myLoader.addEventListener(Event.INIT,loadHandler);
myLoader.trustContent = true;
myLoader.load("../assets/my.swf");
this.addChildAt(myLoader,0);
private function loadHandler(e:Event):void{
movie_clip= e.target.content;
movie_clip.gotoAndPlay(2);
movie_clip.some_custom_as3_method();
For Flex SWF's here is an example:
import mx.events.FlexEvent;
import mx.managers.SystemManager;
import mx.core.Application;
// * gets rid of type checking so we can leave strict enabled
[Bindable]public var _appLoaded:*;
private function
onCurrentApplicationComplete(oEvent:Event):void
_appLoaded = Application(oEvent.target.application);
private function onCompleteAppLoader(oEvent:Event):void
var smAppLoaded:SystemManager =
SystemManager(oEvent.target.content); //get a ref to the loaded app
//listen for the application.complete event
smAppLoaded.addEventListener(FlexEvent.APPLICATION_COMPLETE,
onCurrentApplicationComplete);
// call a custom public method in your application mxml file:
public function setPlaylist(id:int):void {
if(_appLoaded) {
_appLoaded.change_playlist(id);
]]>
</mx:Script>
<!-- <mx:SWFLoader id="player" x="0" y="0" source="
http://...Player.swf"
complete="onCompleteAppLoader(event);" trustContent="true"/>
--> <mx:SWFLoader id="player" x="0" y="0"
source="@Embed('../assets/Player.swf')"
complete="onCompleteAppLoader(event);" trustContent="true"/> -
Flex won't display a child of a container movie clip
I have a Container Movie clip called frameContainer in wich I load new Frames( a symbol from flash), with this function:
var i:Number=0;
frameContainer.x=48;
xPos=0;
do
frames.push(new Frame());
frameContainer.addChild(frames[i]);
slideshow.push(false);
frames[i].index=i;
frames[i].f.width=frameWidth;
frames[i].f.height=frameHeight;
frames[i].x=xPos;
frames[i].y=0;
xPos+=frames[i].f.width+10;
frames[i].f.addEventListener(MouseEvent.MOUSE_UP,fMouseClickOnFrame,false,0,true);
i++;
}while(xPos<200)
frameNumber=i;
this.addChild(frameContainer);
The previous function works great.And I have a function called addNewFrame() which adds a new Frame at the end:
private function addNewFrame():void
frames.push(new Frame());
frameContainer.addChild(frames[frameNumber]);
frames[frameNumber].f.width=frameWidth;
frames[frameNumber].f.height=frameHeight;
frames[frameNumber].x=xPos;
frames[frameNumber].index=frameNumber;
xPos+=frames[frameNumber].width+10;
frameNumber++;
frames[frameNumber-1].f.addEventListener(MouseEvent.CLICK,fMouseClickOnFrame,false,0,true );
But, for some reason, the new frame can't be seen. When I type just
addChild(frames[frameNumber]);
(instead of frameContainer.addChild(frames[frameNumber]) )
it works great. Also I can access the new frame with the getChildAt method, the only, and biggest problem is that I can't see that new frame when I add it as a child of the frameContainer movie clip.
Can someone please helpSame thing in iMovie '09 I just noticed. But it renders, so I guess who cares.
-
How to email a Movie Clip in Flash
Hi everyone.
I am creating a painting / drawing application in flash.
I want to add a functionality, which allows the user to send his/her painting to his/her email address.
How can this be done?
Please note that the painting / drawing would be a movie clip
Help on an urgent basis would be greatly appreciated
ThanksHi,
I did something similar for AS2:basically there was a "designer" swf where one could interact to create a design,
and a "viewing" swf that contained all the bits and pieces used (e.g. a blank t-shirt).
The designer swf would send data (placement of objects, coordinates of strokes) to the server, and the server would amend the blank viewer swf by compiling the data object and adding it as another code block. The code of the viewing swf would handle constructing the desired image, by placing objects, adding strokes, etc.
With the simple structure of AS2 code, php could do that.
I sort of believe that something similar could be done for AS3 if the server is able to run java (the flex sdk programs). Addition: PHP by itself should be able to replace an embedded text file ... such as an xml description of the artwork -
Sync movie clips loaded by swfloader
hi guys,
i have 5 separate movie clips (swf) represent 5 flower petals,
each of them is showing up from center,
i load them in flex app by 5 separate mx:SWFLoader tags.
the problem is they should sync with each other to open up the flower,
but due to being loaded from network, they don't start at the same time.
please help me, how to sync these flower petals?according to http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/controls/SWFLoader.h tml
it doesn't seem like SWFLoader has a method called "rewind()" or "gotoAndPlay(...)"? -
Scrubbing Movie Clip Fills Memory, Crashes Flash
Hello,
We have a Flex 4/Actionscript 3 application that involves "scrubbing" through a Movie Clip that is a swf file derived from a .mov file. This is accomplished by listenening to the change in value of an HSlider and calling gotoAndStop(n) on the Movie Clip repeatedly as the slider is dragged. The Movie Clip is 720 pixels wide by 405 pixels high.
It works great, however, after doing this scrubbing action a number of times, which is required by our application, we notice the memory (by tracing System.totalMemory and System.privateMemory) increasing dramatically; and when it gets to around 100 MB (though it's not the same every time), the Flash plugin in the browser will crash. Our assumption is that this happens because the scrubbing essentially loads dozens of bitmaps (each frame of the Movie Clip that is scrubbed over) very rapidly.
To try and ameliorate this, we have implemented aggressive garbage collection by calling System.pauseForGCIfCollectionImminent(0.1) on a timer every 10 seconds. This usually keeps Flash from crashing, however, sometimes the garbage collection itself causes Flash to crash, though it's not 100% predictable. We know this because we are tracing the garbage collection action and can see Flash crash when that action occurs.
It doesn't seem like we have a memory leak per se, as the free memory is eventually regained when forcing garbage collection.
So I have a couple of questions:
1) Is there any way to keep the memory from getting so large in the first place, given that we need this scrubbing functionality?
2) If not, is there a better way of tweaking the garbage collection so that it frees up memory while not itself causing Flash to crash?OK, I created a new Flex project with just the simplest possible scrubbing code, plus the memory tracing. Unfortunately, I'm getting the same results as I get in our big app. If I can figure out what you're doing differently, I might be able to get somewhere. Here's the code:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" addedToStage="onAddedToStage()">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import flash.display.DisplayObject;
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.EventDispatcher;
import flash.display.Loader;
import flash.system.LoaderContext;
import flash.net.URLLoader;
import flash.net.URLLoaderDataFormat;
import flash.net.URLRequest;
private var swf:MovieClip;
private var loader:Loader;
private var memoryReportTimer:Timer = new Timer( 15000 );
private var initialMemory:Number;
private var currentMemory:Number;
private function onAddedToStage():void {
var req:URLRequest = new URLRequest( "sampleAsset/AlfredCiminoDemoReel.mov.swf" );
var loaderContext:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);
loader = new Loader();
//loader.dataFormat = URLLoaderDataFormat.BINARY;
swfContainer.addChild( loader );
loader.contentLoaderInfo.addEventListener( Event.COMPLETE, swfLoadComplete );
loader.load( req, loaderContext );
//(loader.content as MovieClip).gotoAndStop(1);
//swf.gotoAndStop(1);
trace( "initial free memory allocation: ", (System.freeMemory / 1024).toFixed(2));
initialMemory = Number((System.totalMemory/1024).toFixed(2));
currentMemory = initialMemory;
memoryReportTimer.addEventListener( TimerEvent.TIMER, reportMemoryDelta );
memoryReportTimer.start();
private function swfLoadComplete( e:Event ):void {
trace( "loading complete." );
swf = loader.content as MovieClip;
swf.gotoAndStop(1);
//swfContainer.addChild(swf);
scrubber.maximum = swf.totalFrames;
private function reportMemoryDelta( evt:TimerEvent ):void {
var currentMemory_temp:Number = Number((System.totalMemory/1024).toFixed(2));
var tenSecDelta:Number = currentMemory_temp - currentMemory;
currentMemory = currentMemory_temp;
var overallDelta:Number = currentMemory - initialMemory;
trace( "10 second change: ", tenSecDelta, ", overall change: ", overallDelta );
trace( "free memory: ", (System.freeMemory / 1024).toFixed(2));
public function setCurrentFrame():void {
swf.gotoAndStop(scrubber.value);
]]>
</fx:Script>
<s:VGroup>
<mx:UIComponent id="swfContainer" width="720" height="405">
</mx:UIComponent>
<s:HSlider id="scrubber" change="setCurrentFrame()" width="100%" />
</s:VGroup>
</s:Application>
And here's the tracing output: -
hello,
i am building a full flash site, and i have created animated
buttons seperatley,outwith the main fla, and i have imported them
into the main timeline. The button file is a movie clip,and works
beautifully when testing from its own fla,but it does not work (no
animation on roll over) when i embed it into my main site. Below i
have trhe action script
On top level main timeline,where movie clips reside,in one
keyframe -
this.onEnterFrame = function(){
if(rewind == true){
prevFrame();
this.onRollOver = function(){
rewind = false;
play();
this.onRollOut = function(){
rewind = true;
this.onRelease = function(){
getURL("
http://www.kirupa.com","_blank");
within each button movie clip
stop();
this.onEnterFrame = function(){
if(rewind == true){
prevFrame();
this.onRollOver = function(){
rewind = false;
play();
this.onRollOut = function(){
rewind = true;
this.onRelease = function(){
getURL("
http://www.siteName.co.uk","_blank");
any ideas ?
hope you can help !This is what I came up with and it seems to work... can this
be refined and improved on?
For example, what if I want it to return to its original
value when clicked a second time? -
Can't get nested movie clip to play
Hi everyone,
I have a movieclip on one of the frames on the maintimeline.
Within this movieclip is a nested movieclip which itself is
contained by another clip. The first movie clip plays to a certain
frame where I've got some code telling the nested movie clip to
play at that frame but this nested clip doesn't play. I'm not sure
if I'm targetting the nested clip incorrectly or whether something
else is wrong with the code.
The .fla file can be downloaded at:
http://www.officelinkonline.com.au/Ad/
if someone would take a look. The movie clip in question is
on the layer called text5, and within this mc on frame 15 is the
code I'm trying to use to get the nested movieclip to play at that
point. The code used on that frame is:
this.innerText5_mc.free_mc.play();
stop();
pauseAnim = setInterval (this, "nextFrame", 4000);
I wondered if someone could take a look and see what I might
be doing wrong? Basically the free_mc clip just makes the word
"FREE" scale up.
Would really appreciated any advice.
ThanksThanks again. I'm a bit worried that you weren't able to see
the font that I used. All of the text used in the animations are
static text fields. I don't seem to have the option to embed these
characters since it's static text. It'll only let me embed if the
text fields are dynamic. Does this mean I have to change them all
to dynamic text fields, and if so do I need to embed the font in
every text field in every frame of the animation or can you do this
in one place?
Appreciate your continued help. -
I'm using an actionscript scrolling '3d' grid for a
background in a flash file and I want to use it in another. Problem
is, for the darndest reason, the script wouldn't work in my
original file *but* I tweaked the sample file to get it to work, so
I could use that, perhaps. Long story short (too late?) I would
like to embed an .swf as a movie clip into another file so that the
scrolling background will just play while other things are going on
on different layers, but when I try to export the .swf from the
scrolling field file, I don't get the working scripted behavior in
the movie clip. I'm fairly new to Flash and would like to know if
there is any way to fix this.
The method I used to create the scrolling field is
essentially what is described here:
http://www.sitepoint.com/article/perspective-moving-effect
Please help!no, you do not. just click on your w00t movieclip and in the
properties panel type:
w00tMC. repeat for your widget and type: fa in the properties
panel.
and in then click on an empty part of the stage (or
off-stage) and in the actionspanel paste: -
Add movie clip in a New Native Window
Dear Friends,
i have created an air application, which open a new window on
click of a button and load the movie clip or a scroll pane with
some items in it. it is working fine but the size is very big than
the actual size of the movie clip. it shows like zoomed picture. it
looks odd and i got sturck up. please help me to show the correct
size of the scroll pane which i added (i used --
nativewindow.stagge.addchild) in native window.
Thanks and advance,
RahimhajiYou must set the stage scaleMode property to noScale. (If you
want to use one of the other scale modes -- even though there are
better ways to achieve the same end in AIR, see the " About Stage
properties" section of:
http://www.adobe.com/devnet/air/flex/quickstart/launching_windows.html
The article is about a Flex application, but the stage
properties section applies equally to Flash. ) -
Hello Forum,
I am baffled by something i "created". I have a swf file,
that has 3 containers (aka movieclips).
my first container (cleverly named "container") gets an
attached movie clip beginning in frame 1 of the root timeline.
I also have a clip on my stage (called "NavigationPane").
This is a movie clip as well. This is dragged to the stage at the
design mode.
My clip NavigationPane has an instance name
("navigaionpane"). This also has a border that gets sized
dynamically at run time.
My stage size is 640x525, and my resize for the
navigationpane is 640x480. so far so good. If I run the swf file
from flash player all works fine (or so it seems).
My challenge is when I embed the swf file in an html page,
and set the swf file to a smaller size (512x420 for the "stage"),
the clip plays ok and at my desired size. I am using code
like this to "resize" the swf object:
<script type="text/javascript">
<!--
writeDocument('<object
classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="
http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"
scale="exactfit" width="512" height="420" ID="Captivate1">'+
'<param name="movie" value="Module1-4Buttons.swf">'+
'<param name="quality" value="high">'+
'<param name="loop" value="0">'+
'<embed src="Module1-4Buttons.swf" width="512"
height="420" loop="0" quality="high" pluginspage="
http://www.macromedia.com/go/getflashplayer"
type="application/x-shockwave-flash"
menu="false"></embed>'+
'</object>');
//-->
</script>
<noscript>
<object
classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="
http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"
width="512" height="420" ID="Captivate1">
<param name="movie" value="Module1-4Buttons.swf">
<param name="quality" value="high">
<param name="loop" value="0">
<embed src="Module1-4Buttons.swf" width="512"
height="420" loop="0" quality="high" pluginspage="
http://www.macromedia.com/go/getflashplayer"
type="application/x-shockwave-flash" menu="false"></embed>
</object>
when the clip starts to play the size show as 512x420 (swf
stage size is 640x525).
I have code (actionscript) set at about 1/2 way thru clip to
resize the nav pane to 640x480. when the code runs to resize the
nav pane - the html sizing seems to be bypassed, and I get a piece
of the stage in my 512x420 "window" in my html file.
It seems that the resize overrides the html code. should I
bite the bullet and just resize everything for my 512x420 size?
thanks,
eholz1ok I seem to have made some progress, but also stepped back
at the same time. I exported it as flv in premiere 2.0, and
imported to flash 8 as embedded video. bottom line quickly, it now
plays two times and stops, so thats better. :) however all of my
control buttons stopped working. I did instantiate the flv as
-video-, but the scripts shown above no longer work. It also
autoplays at load, so in publish settings I told it not to, but
without the buttons working I cannot get it to play at all. Chuckle
chuckle. So if autoplya, it plays twice, but my buttons do not work
at all, if no autoplay, it can do nothing as the buttons do not
work.
I am surprised the buttons do not work as the instance is
still video and I did not change anything. Ah so much I do not
know. Can you nudge me along a little further. I sure appreciate
yours and anybodys help as I try to get out of kindergarten. -
In Premiere I can edit an avi or mov clip but I can not save tghe result as a like file. What do I have to do??? It only saves a project. Under 'File' the 'Export' function is greyed out. I need help baddly.
[email protected]
Bill SchoonBoatbuilder
Let us start from the beginning.
It has been established that you have Premiere Elements 10. On what computer operating system is it running?
There has not been a File Menu/Export/Movie export opportunitity in Premiere Elements since version 7. We are not up to version 12.
For Premiere Elements 10, your export opportunities are all in Share/ including one for Computer. Under Computer there are several choices. The ones that you see are Adobe Flash Video, MPEG, and AVCHD. The others you have to scroll down to. And those choices are AVI, Windows Media, QuickTime, Image, and Audio. You do not have to use the scroll bar for this. You can click on Adobe Flash Video panel to get it to turn black. Then use the down arrow to go down the list and the up arrow to go up the list. Once you get to a category, you can select a preset and go with it or customize it under the Advanced Button/Video Tab and Audio Tab of the preset.
If you post the properties of your source media that you want to try to match in the export, I would be glad to suggest the exact settings for you.
We will be watching for your follow up with details.
Thank you.
ATR
Add On...The Premiere Elements 10 File Menu is for more than Saving, just not exporting. One of the key features that can be access there is the Project Archiver. More on that another time. -
Unable to Sync Quicktime Movie Clips with IPOD
I am a new ipod user having difficulty syncing Quicktime movie clips to IPOD.
Clips are saved as .mov files and Itunes will play.
However I cannot get them to sync woth IPOD.
Any ideas - Do I need to convert to annother format?First you need to import your movies into iTunes. Do this by opening iTunes <File> <Import> <Movies> then choose the movie you want to put on your iPod. Make sure the movie has .mov at the end otherwise it won't be set up the way it's supposed to be.
Once the movie is imported into iTunes right click on it so a pull down menu appears. Click on <Convert Selection for iPod/iPhone>. It should begin converting it on its own and when it's done you'll hear the typical sound that happens after importing a cd, telling you the operation is complete.
After it's converted, you will have 2 identical movies in your menu. If you <Get Info> on each, you should be able to see which is newest version; that is the movie you are going to want to sync.
Then plug your iPod in to iTunes, go to the movie tab in iPod summary and check off the converted movies you want to sync to your iPod. Press <Sync> and that should add your movies to your iPod.
Hope this helps.
Maybe you are looking for
-
How do I deploy dependent jars in a standalone soa server?
Hi, I have deployed a webservice on a standalone SOA server. When I try to execute it I see the following message: faultstring>JBO-25002: Definition oracle.apps.cdm.tcaModel.parties.core.model.publicEntity.PartyPEO of type Entity Definition not found
-
An error message "B channel out of service".
Much thanks for you spent time to answer my question. I set the "E1 Enhanced Card" on VG200 for MGCP and work with CCM3.3.2. Also the IOS of VG200 has been upgraded to version 12.3<3a>. But this error also will generated of each B channel.Could you h
-
I keep getting a message saying no AMD graphics istalled or not working properly on start up on hp laptop This question was solved. View Solution.
-
Is there a way to recover muse files
I recently restored my PC and lost my muse files since I published them in Muse to a business catalyst domain I was wondering if there was a way to retrieve those published muse files so I can finish my website.
-
How to greate price agreements with scales
Hi, at the moment I have problems to create price agreements incl. different scales in CRM 4.0. I don´t know which bapi or function module is the correct one. In the last hours I used following function modules: - CRM_PRICE_AGRMNTS_MAINTAIN_OW - /SAP