Go Back   CodingForums.com > :: Client side development > Flash & ActionScript > Adobe Flex

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-12-2010, 10:55 AM   PM User | #1
davidhopkins
New Coder

 
Join Date: Mar 2010
Posts: 17
Thanks: 1
Thanked 0 Times in 0 Posts
davidhopkins is an unknown quantity at this point
SWF Loader and MovieClip problems

Hello all.
I am using the following code to import a swf file that has a number or frames. When i hit next or previous it moves either to the next or previous frame.

The code is as follows

Quote:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" applicationComplete="load()">
<mx:Script>
<![CDATA[
private var flashMovie:MovieClip;

private function initMovie():void{
flashMovie = loader.content as MovieClip;
}
private function load():void{
flashMovie.stop()
}
]]>
</mx:Script>
<mx:SWFLoader id="loader" source="flash.swf" complete="initMovie()"/>
<mx:Button label="Next" click="flashMovie.nextFrame()"/>
<mx:Button label="Previous" click="flashMovie.prevFrame()"/>
</mx:Application>
This works fine, everything is as i want, apart from i want what ever SWF frame is being displayed, to be displayed on all web browsers that have the page open.

I imagine i would be able to use an XML file, and pull the frame being displayed from that and have it check the XML file every couple of seconds ?

Although saying that im not 100% sure on how to achieve this.

Can anyone offer some help please?
davidhopkins is offline   Reply With Quote
Old 05-12-2010, 12:37 PM   PM User | #2
davidhopkins
New Coder

 
Join Date: Mar 2010
Posts: 17
Thanks: 1
Thanked 0 Times in 0 Posts
davidhopkins is an unknown quantity at this point
Ok, So i have been working on this concerpt a little more.

I have created a HTTPS service,

Quote:
<mx:HTTPService id="getImage" result="handleImage(event)" url="change.xml" method="POST">
<mx:request xmlns="">
<dataDumping>
{dataDump}
</dataDumping>
</mx:request>
</mx:HTTPService>
This pulling data from the XML file where i plan to store the frame that needs to be displayed on of the SWF file.

I checked that the HTTP service was working by using the function

Quote:
private function handleImage(event:ResultEvent):void
{
img1.source = event.result.imagelocation;
}
And as i expected when i change the xml file, the image changes.

However i created a variable

private var i:String = "test";

And planned to have the HTTP service change the value of this value. I assumed it would be the same code as what i previously used,so used the following code

Quote:
private function handleImage(event:ResultEvent):void
{
var i = event.result.imagelocation;
}
However using this, it dosent update the value of the variable being displayed in the text box,

Quote:
<mx:Text x="817" y="10" text="Total: {i}" width="157"/>


Can anyone see where i am going wrong ?
davidhopkins is offline   Reply With Quote
Old 05-15-2010, 11:17 PM   PM User | #3
Inigoesdr
Super Moderator


 
Inigoesdr's Avatar
 
Join Date: Mar 2007
Location: Florida, USA
Posts: 3,601
Thanks: 2
Thanked 397 Times in 390 Posts
Inigoesdr is a jewel in the roughInigoesdr is a jewel in the roughInigoesdr is a jewel in the rough
Do you have "i" set to bindable with the meta tag?
Code:
[Bindable]
private var i:String = "test";
Also, try making "i" public, and tracing the value of "i" & the return from the HTTPService inside of your function that is updating the value.
Inigoesdr is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:47 PM.


Advertisement
Log in to turn off these ads.