Help Needed: XML Attributes based style mapping!
Hello all, I am new in this Group. I've reviewed the contents which posted earlier. It is pretty good.
I need a help from this script forum regarding on mapping the attribute based style mapping.
like: <emphasis style="italic">Text</emphasis> to be mapped as Italic character style
<emphasis style="bold">Text</emphasis> to be mapped as Bold character style
Any one example of VBS / JS is enough, Your highly response / help will be appreciated.
Thanks
Guna
Hi gunasekarant
here I am giving you the sample XML and XSLT files this works fine
XSLT
<xsl:transform
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/" xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/">
<xsl:template match="root">
<xsl:apply-templates/>
</root>
</xsl:template>
<xsl:template
<xsl:template match="emphasis[@style='bold']">
<b><xsl:apply-templates/></b>
</xsl:template>
<xsl:template match="emphasis[@style='italic']">
<i><xsl:apply-templates/></i>
</xsl:template>
</xsl:transform>
XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<root>
<emphasis style="italic">Text</emphasis>
<emphasis style="bold">Text</emphasis>
</root>
I have no idea about XSLT for Docbook for downloading you can develop
Similar Messages
-
Help needed with attributes losing their values
Hi there, I have the following code.
public void actionPerformed(ActionEvent event)
// Check to see if Search button pressed
if (event.getSource() == searchButton)
// Read the isbn and title text fields
String supplier = supplierTxtField.getText();
String name = nameTxtField.getText();
String type = (String)typeBox.getSelectedItem();
System.out.println (supplier+" "+name+" "+type);
// Display an error message if there is no data in
// isbn and/or title text fields
if (type.equals(""))
JOptionPane.showMessageDialog(frame, "Please enter a product type");
if (supplier.equals("") && name.equals(""))
JOptionPane.showMessageDialog(frame,
"Error - you need to enter a supplier and/or item name and item type");
else // OK to carry out search
// Search for book(s) based on either the
// isbn or title entered above
System.out.println(supplier+" "+name+" "+type);
searchForItem();
//OTHER IRRELEVANT CODE
* Search for books. We can search for books based
* upon an ISBN code or title.
private void searchForItem()
// Call the bookSearch() method in DataBaseHandler Class
// This method returns a reference to a ResultSet object.
System.out.println (supplier+" "+name+" "+type);
rs = BellFiresDataBaseHandler.itemSearch(supplier, name, type);
// Clear form
clearForm();
// Set recordCount to 0
stockCount = 0;
// Display the book details on the form
displayItemDetails();
} // End searchForBooks()At the end of actionPerformed, the attributes print out as they should, in this instance the type is Fireplace, the supplier is ABC and the name is null. However, when the same attributes are printed out in the itemSearch method, the values are all null!!! There is nothing that happens in between the two methods and i am completely baffled as to why it does this. It worked fine before i recently changed the input method of the type to JComboBox instead of text field and i had no problems passing through the values.
If anyone could help me out with this it would be great!
Thank you!
Edited by: Chrift on May 24, 2009 10:01 AMAh thank you, so by having the word String in front of the variable names when declaring them i was overriding them and therefore making them local variables.
I think this is correct, i havent time to test it at the moment so i will declare this question answered when i do!
Thank you very much :D -
Help needed - XML forms not displaying in my repository
Hi all
I could really do with some help here. I have a custom XML form for news articles. It works fine in the standard documents repository, but I have my iView pointing to a folder in my own CM repository.
When a user tries to directly access the "show" form, instead of the form it displays the XML code. Any ideas why this is?
My CM repository is running the following services:
layout, properties, svc_acl, tbp
EP6SP14
Thanks! ChrisHello,
I have the same problem. When I'm trying to create an XML file using XML form in the repository /etc, I get the following error:
XML - Forms
Cannot create item e0977870-cf29-2d10-bb89-d00b5761268c.xml in collection /etc/public/; operation is not supported.
When I do the same in repository /documents, it works fine.
I think, I've made the neccesary settings for the repository (Form Based Publishing, ...).
Any clues will be highly appreciated.
Jiri -
I have troubles with my XML query. It returns to many results and double results.
My code
select xmlelement("test", XMLAgg(xmlelement("Customer", XmlAttributes(a.CUSTOMER_ID "cid"))),
XMLAgg(xmlelement("Account", xmlagg(xmlelement("Account", b.ACCOUNT_ID) ))),
XMLAgg(xmlelement("ServicePoint", xmlagg(xmlelement("sp", c.SPID) ))) ).extract('*').getstringval() xml
From DM_SERVICE_POINT c, DM_CUSTOMER a, DM_ACCOUNT b where a.CUSTOMER_ID = b.CUSTOMER_ID And a.CUSTOMER_ID=c.CUSTOMER_ID AND a.CUSTOMER_ID='15058'
group by a.CUSTOMER_ID
i have 1 customer id in the table dm_customer, 2 account_id 's that are linked to customer_id with a FK. DM_Servicepoint contains 6 rows that are linked to dm_customer with a FK.
My result is 1 result for customer, thats correct but account shows 12 results, where i expect 2 results
and Service point shows also 12 records where i expect 6 records.
There is no direct link between account and service point but both are linked to customer. Each customer can have 1 or 2 account And each customer can have 1 or many servicepoints.
Can you help me?
Message was edited by:
MarindaNow to see whether we can get this to work with XML....Turns out it's a lot easier than I thought it would be:
SQL> select dbms_xmlgen.getxml('select c.name
2 , cursor(select a.acctno, a.name
3 from my_accounts a
4 where a.cust_id = c.id ) as accounts
5 , cursor(select s.sp_ref
6 from my_service_points s
7 where s.cust_id = c.id ) as srv_points
8 from my_customers c
9 ') from dual
10 /
DBMS_XMLGEN.GETXML('SELECTC.NAME,CURSOR(SELECTA.ACCTNO,A.NAMEFROMMY_ACCOUNTSAWHE
<?xml version="1.0"?>
<ROWSET>
<ROW>
<NAME>APC</NAME>
<ACCOUNTS>
<ACCOUNTS_ROW>
<ACCTNO>900000</ACCTNO>
<NAME>No1 a/c</NAME>
</ACCOUNTS_ROW>
<ACCOUNTS_ROW>
<ACCTNO>900002</ACCTNO>
<NAME>Business</NAME>
</ACCOUNTS_ROW>
</ACCOUNTS>
<SRV_POINTS>
<SRV_POINTS_ROW>
<SP_REF>SP1</SP_REF>
</SRV_POINTS_ROW>
<SRV_POINTS_ROW>
<SP_REF>SP2</SP_REF>
</SRV_POINTS_ROW>
<SRV_POINTS_ROW>
<SP_REF>SP3</SP_REF>
</SRV_POINTS_ROW>
<SRV_POINTS_ROW>
<SP_REF>SP4</SP_REF>
</SRV_POINTS_ROW>
<SRV_POINTS_ROW>
<SP_REF>SP5</SP_REF>
</SRV_POINTS_ROW>
<SRV_POINTS_ROW>
<SP_REF>SP6</SP_REF>
</SRV_POINTS_ROW>
</SRV_POINTS>
</ROW>
<ROW>
<NAME>MARINDA</NAME>
<ACCOUNTS>
<ACCOUNTS_ROW>
<ACCTNO>900004</ACCTNO>
<NAME>Checking</NAME>
</ACCOUNTS_ROW>
</ACCOUNTS>
<SRV_POINTS>
<SRV_POINTS_ROW>
<SP_REF>SP7</SP_REF>
</SRV_POINTS_ROW>
<SRV_POINTS_ROW>
<SP_REF>SP8</SP_REF>
</SRV_POINTS_ROW>
</SRV_POINTS>
</ROW>
</ROWSET>
SQL> Obviously you'll need to do some smartening up of the tag names.
Cheers, APC
Blog : http://radiofreetooting.blogspot.com/ -
Help Needed, (Stuck on quotation styles)
Hi!
It might be a really easy question to answer, never the less:
I have inDesign CS4, and I writing a document, where I have alot of quotes.
All I want is to automaticly select the quotes, and change them to bold font style.
Only think I found that culd work is nested Styles, but I don't have a cluewhat order or what to put.
Can anyone help please?What you want is a paragraph style for quotes that has the formatting you want. Whether this requires a nested style, a GREP style, or nothing special, depends on what thes paragraphs look like. Are the quotes self-contained paragraphs, or embedded in other text? If embedded, is there only one quote or can there be more? Are quotes always surrounded by quotation marks?
We need complete details about waht the text looks like before we can offer good advice. A screen capture showing the desired result would be a big help. You can use the camera icon on the web page to embed an image in a post like this: -
Help needed with condition based joins in pl\sql
Hi,
I need to get data from 6 tables,
Scenario 1 : I need to join 4 tables and join this result set to 5th table
Scenario2: resultset of join of 4 tables to 6th table
In this case how do i save the intermediate result set of 4 tables to use it in further joins.Welcome to the forum.
Your question is broad.
http://tkyte.blogspot.com/2005/06/how-to-ask-questions.html
A more detailed example would help.
Mention your database version as well and see the FAQ http://forums.oracle.com/forums/help.jspa when it comes to posting formatted examples using the {noformat}{noformat} tag
However, i think using the WITH clause or a subquery ( a.k.a. inline view) is what you're looking for.
Do some searches on http://asktom.oracle.com to find many examples.
Also see:
http://www.oracle-base.com/articles/misc/WithClause.php
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/queries007.htm#sthref3193 -
Help Needed!! - Yamaha Drum Mapping
This has probably come up before but the things I've tried havn't seemed to work:
I need to remap the Yamaha DTXplorer drums in Logic Express, as the snare is currently silent and the kick does some sort of roll.
I've tried using midipipe already (which caused more problems than it solved so would prefer to avoid that at all costs). I've also tried inserting a mapped instrument into the clicks&ports layer in the environment, and then remapping the 'output notes' to what they should be (e.g A0-C1 and G0-D1) but there is still no sound produced when I hit the pads, or on playback after I've recorded them.
The other thing is I would like to be able to use a MIDI keyboard as well without causing a problem with that.
I am a beginner and despite spending hours trying to sort this out by myself I've hit a brick wall. Is anyone able to offer a simple tutorial to sort this out?
Thanks in advance
DanMany thanks for the reply.
Currently all pads work correctly apart from the kick and the snare. The snare for example has no audio assigned to it, if I was to transpose wouldn't the other parts of the drum kit then match up incorrectly? I also want to have the correct setup when recording, rather than just at the playback stage so I can hear exactly what is being recorded.
I'm basically looking for some step-by-step instructions that I can try in order to fix it, I used to understand logic a lot better but after not using it for years I'm back to trial and error with things. -
I am creating a level based hierarchy for the Date Dimension
year --> quarter --> month --> date (one path)
year .--> month --> date (the second path).
I create the pivot table using these dim hierarchies. But the problem is,
when I click on, say "Month" under year 2012, it expands everything above 2012 (such as 2010, 2011 etc).
I don't want to expand all the years, but only the one I clicked. Anyone knows what is the solution for that.
I am sorry that I cannot attach any screen shots to explain better.
I would really appreciate your help on this.
Thanks
JDI am using OBIEE 11.1.1.7.0.
ok, I tried one hierarchy per dim table but didn't work too. When I created a logical column as Month + Year (e.g Jan 2014) and added to the hierarchy, its working fine. But that creates other issues on the
client side.
I guess, since the month is common to all the years its expanding when clicked. I also added month and year as "chronological key", but that didn't work either.
Please advice any solution if you know it. -
Help needed XML to Internal table and vice versa
Hello frnds, I need to convert Internal table to XML and Vice versa.
Now I am able to most of the part except for this...
the xml which I have to generate looks something like this...
- <trade_dt>
- <![CDATA[ 20111108000000:20111108235959
]]>
</trade_dt>
its a range I think
And then the reponse which I get back the XML is like
- <lockinfo>
- <![CDATA[
TRD_HEADER 1045 1 2
ACT_CASHFLOW 1042 1
TRD_TERM 1045 2
]]>
</lockinfo>
Is there any provision in class cl_ixml or class if_ixml_element to handle this part.....
Edited by: Amit Sawant on Dec 28, 2011 3:51 PMHello Amit,
I would suggest you, to use the XSL-Transformations, which can be inbound used in ABAP.
For example:
DATA:
l_xml TYPE string,
lt_flights TYPE TABLE OF SFLIGHT.
SELECT * FROM SFLIGHT INTO TABLE LT_FLIGHT.
CALL TRANSFORMATION id
SOURCE DATA = lt_flights
RESULT XML l_xml.
Now, you have a XML-String which is in the ABAP-XML Notation, which means, that ABAP can move this XML-Data back into an internal table/structure.
For the backward, you have to use the following statement:
CALL TRANSFORMATION id
SOURCE XML l_xml
RESULT DATA = lt_flights.
As you will see, it is very easy. The Transformation "id" is just one example and build in. When you have to transform the data, or do not want to have the ASX-Notation in it, you should at least define your own transformations with the transaction XSLT_TOOL and use it similar to the transformation "id".
Kind Regards,
Hendrik -
Help needed Urgently- Rebate based on collected amount
Dear all,
I come across scenario while discussiion with client that they require rebate with collection. Details of the requirement are given below:
1. SAP rebates run on billed values & set the accrual in rebate agreement on the rate what we have specified in the rebate agreement. Requirement is that, If i have billed on 1000$ & my accrual value is 100$ with the rate of 10%. If i collected 800$ instead of 1000$, then i need to pay the accrual on the basis of 800$ not on the basis of 1000$. It means i have to adjust accrual amount on the basis of 800$. Conclusion is that i have to pay not 100$ accrual instead less then 100$ on the basis of 800$ which i collected.
2. In month 1 have billed on 5000$, my accrual amount is 500$ with rate of 10%. In the 2nd month i have to bill 1000$ and i have given an discount of 500$, it means my billed value is 500$ and my accrual amount is 50$@10%. In month 3 again i billed 500$ and my accrual amount is 50$@10%.
Requirement is that, when i am going to pay the accrual to client, i should pay correct accrual for which he is entitled for. Means i should pay 100$ accrual not 600$ because i have already given an discount of 500$. Discount which i have given already of 500$ should need to be offest with the first month accrual of 500$. So remaning accrual is 100$.
Great if somebody can help me out for the solutioning of the above requirements.Thanks Ivano,
Somebody has started the conversation.
Let me put my questions again.
This requirement is nothing to do with Payment procedure in the agreement type.
1. In any month if i billed 1000$, so my account receivable would be 1000$. My rebate for that month is 100$ at the rate of 10%. During customer receipt if i collected against my invoice 900$ instead of 1000$, my accrual needs to be corrected 90$ instead of 100$.
I know this can not be fullfilled by standard SAP, by any thoughts on this welcomed.
2. I know Rebate can be settled partially or full settlement by payment method( by cheque, bank transfer, or by credit memo) we have configure in rebate agreement type. But here requirement is totally different.
Here, i need to pay the Rebate as a Discount instead of by cheque or by credit memo. While doing the partial or full settlement system will take into account collected accrual up to that day & apply as a discount to the final bill.
Scenario is like that sometimes customer asked to give us the discount on bill for whatever they accrued so far.
This is again cannot solved by standard SAP, but any thought by any body welcome. We have already thought that we need to enhance the solution.
Solution needed urgently. -
Help needed in Role Based authorisations in WEB UI for RESELLER Role
Hi All,
I am working on a requirement where i need to disable/hide/grey out EDIT button on Account Details and on all assignment blocks in WEBUI(CRM2007). This is needed for the accounts having the Role RESELLER only.
The same functionality is working fine in GUI. This is achieved by Role based authorizations.But the role based authorizations are not working in WEBUI.Any pointers on how to achieve Role Based authorizations in WEBUI.
Thanks in advance.
Regards,
Udaya
Edited by: Udaya Bhaskar Perecharla on Aug 20, 2008 12:31 PM
Edited by: Udaya Bhaskar Perecharla on Aug 20, 2008 12:33 PMHi Uday,
Could you let me know the process to disable the edit button for the following scenario -
Using Account Managment, you can display the Account and on double clicking the reponsible employee (hyperlink), WEB UI displays the employee master record with option edit. You can edit the employee details here, which I don't want. User should only be displayed with the employee details without option of editing the master record. How can I achieve this without changing any code..
Your kind assistance will be highly appreciated.....
Cheers,
Peter J. -
Help Needed in Set based query
Hi,
Version : sqlserver 2008 R2
sample data to play with,
declare @Address table(Id int primary key identity(1,1),Address varchar(100),city varchar(20),State varchar(20))
insert into @Address
select '123 sheril street, Newyork,NY','Newyork','NY' union all
select '333 bamboo street, Manhattan,NY', null,null union all
select '123 merrit street, Albany,NY','Albany','NY' union all
select '123 shego street, Buffalo,NY',null,null
This is just sample data. i have around 100000 address for different city and states.Basically i need to remove the city and state from address
Here is what i need to achieve,
1. Get the city,state check exists on address column if found then remove the city and state. if not leave it as it.
2. If the city and state column is null and if that is present in address column then remove that from address column and update it in city and state column
respectively.
Is this possible to achieve without cursor or looping? any sample query please .
loving dotnetThis gets you part of the way there. You'll have to perform your own logic to determine if you want to update the address field or not. I attached a split function that I found online, you'll need that to get the desired results.
declare @Address table(Id int primary key identity(1,1),Address varchar(100),city varchar(20),State varchar(20))
insert into @Address
select '123 sheril street, Newyork,NY','Newyork','NY' union all
select '333 bamboo street, Manhattan,NY', null,null union all
select '123 merrit street, Albany,NY','Albany','NY' union all
select '123 shego street, Buffalo,NY',null,null
;with parts as
select a.Id, LTRIM(RTRIM(ISNULL(foo.Item,''))) as Item
from @address a
CROSS APPLY DBO.SplitStrings_Moden(a.Address, ',') as foo
[rows] as
select id, [1] as [Address], [2] as [City], [3] as [State]
FROM
select Id, Item, ROW_NUMBER() over(partition by id order by id) as rowNumber
from parts
) a
PIVOT (max(Item) for rowNumber in ([1], [2], [3])) as pvt
merge into @Address as Target
using rows as Source
ON (Target.Id = Source.Id)
WHEN MATCHED THEN
UPDATE SET
Target.Address = Source.Address,
Target.City = Source.City,
Target.State = Source.State;
select * From @Address
ALTER FUNCTION dbo.SplitStrings_Moden
@List NVARCHAR(MAX),
@Delimiter NVARCHAR(255)
RETURNS TABLE
WITH SCHEMABINDING AS
RETURN
WITH E1(N) AS ( SELECT 1 UNION ALL SELECT 1 UNION ALL SELECT 1 UNION ALL SELECT 1
UNION ALL SELECT 1 UNION ALL SELECT 1 UNION ALL SELECT 1
UNION ALL SELECT 1 UNION ALL SELECT 1 UNION ALL SELECT 1),
E2(N) AS (SELECT 1 FROM E1 a, E1 b),
E4(N) AS (SELECT 1 FROM E2 a, E2 b),
E42(N) AS (SELECT 1 FROM E4 a, E2 b),
cteTally(N) AS (SELECT 0 UNION ALL SELECT TOP (DATALENGTH(ISNULL(@List,1)))
ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) FROM E42),
cteStart(N1) AS (SELECT t.N+1 FROM cteTally t
WHERE (SUBSTRING(@List,t.N,1) = @Delimiter OR t.N = 0))
SELECT Item = SUBSTRING(@List, s.N1, ISNULL(NULLIF(CHARINDEX(@Delimiter,@List,s.N1),0)-s.N1,8000))
FROM cteStart s; -
Mar 29, 2010 4:22 AM
Hi
I am working with XML Project in indesign CS3. In my document have the following xml elements
<emphasis style="italic">Italic text</emphasis>
<emphasis style="bold">bold text</emphasis>
<emphasis style="bold-italic">Bold Italic text</emphasis>
<emphasis style="sup">Superscript text</emphasis>
<emphasis style="sub">Subscript text</emphasis>
I have a same element name but distinguish with attribute, i need to control styles with this attribute.
Can you please help me, how to control style with XML attributes.
Thanks in Advance
RajasekarYou need to add the InDesign namespace in each tag to apply different character styles based on the formatting.
-
Help to overcome 32K XML limit for Anychart Map
Hello,
Apex version 4.2.0.00.27
I am creating a heat map using the Anychart maps and have chosen to use the "Use custom XML" option in the Map Attributes to control the map being generated. However, I have hit a 32K limit for 'Custom XML' that is being passed to the Map.
A sample of the XML is:
<?xml version="1.0" encoding="UTF-8"?>
<anychart>
<charts>
<chart plot_type="Map">
<b>&P_MAPXML.</b>
<palettes>
</palettes>
</chart>
</charts>
</anychart>
I am using a procedure to generate the required XML and have created an Application Item (P_MAPXML) to hold the data. When P_MAPXML along with the enclosing XML is less than 32K then map dispalys correctly. If the XML generated is more than 32K then an error occurs as it truncates P_MAPXML and the Custom XML is no longer well formed.
There is a workaound via an old thread AnyChart gantt with custom xml and more then 32k but I was wondering is there a more upto date solution.
Edited by: user11899724 on 15-Apr-2013 04:45Thanks Hiliary,
I soldiered on before I saw your reply.
I basically wanted an example of the minimum necessary to display an Anychart Map via the javascript method as there seemed to be issues with the examples that were on the forums not least assuming that every step was understood.
Anyway below I have put steps together just to display an Anychart Map and then along with your example above or the others from the Forum it can be customized to display dynamic data.
1. Create a new page within Apex
i) Under Application choose Create Page -> Blank Page -> Page Alias - (type: WorldMap) -> Name (type: World Map) -> ->Finish
2) Click Edit Page
3) Right Click on Region , Choose Create -> Click PL/Sql Dynamic Content ->Title (type: World Map) ->
Under Pl/SQL Source cut and paste the following:
<pre>
htp.prn('<textarea cols="500" rows="100" id="rowData" style="display:none">');
htp.prn('<anychart>
<charts>
<chart plot_type="Map">
<chart_settings>
<title enabled="true"><text>World Map</text></title>
<chart_background enabled="false"/>
<data_plot_background enabled="false"/>
</chart_settings>
<data_plot_settings>
<map_series source="world/world.amap">
<projection type="Mercator" centroid_x="10.4515266418457" centroid_y="51.1656913757324"/>
<undefined_map_region>
<tooltip_settings enabled="true">
<format>{%REGION_NAME}</format>
</tooltip_settings>
<label_settings enabled="true">
<format>{%REGION_NAME}</format>
</label_settings>
</undefined_map_region>
</map_series>
</data_plot_settings>
<data>
</data>
</chart>
</charts>
</anychart>');
htp.prn('</textarea>');
-- Line below seems to be coming out blank, should be:"<!-- htp.prn('<div id="chartMap"></div>'); " -->
htp.prn('<div id="chartMap"></div>');
htp.prn('<script type="text/javascript" language="javascript" src="/i/flashchart/js/AnyChart.js"></script>
<script type="text/javascript" language="javascript">
AnyChart.swfFile = ''/i/flashchart/swf/AnyChart.swf'';
var chart = new AnyChart();
chart.width = "800";
chart.height = "400";
var data = document.getElementById("rowData").value.toString();
chart.setData(data);
chart.write("chartMap");
// alert(data);
</script>');
</pre>
Click Create Region
4) Run the Page.
If all is well it shoulld display the World Map, just be careful with the div tag line as that will need to added manually.
As said previously, there's lots of help on the forums about creating the dynamic content but this should be a good place to start, having a map that will display using that method. -
Need help with xml video gallery
Hello everyone
I recently bought a xml video gallery. I'm loading the movie externally into another movie. When the xml gallery loads, it cancels all sounds.
I need to figure out where in the actionscription can i reverse the cancellation of sounds. Can anyone help? if possible, I can email, whomever is willing to help, the xml gallery to see if theres another reason the sound is being canceled.
Also, the sound of the gallery doesn't work til you click the volume scroller.
Here are two parts of actionscript included in the gallery:
part one:
// Import filter classes
import mx.transitions.Tween;
import mx.transitions.easing.*;
// Set flash variables
var xmlFileUrl:String = "playlist.xml";
var auto_play:String = "true";
// Set xml file URL
if (_root.xmlfile) {
xmlFileUrl = _root.xmlfile;
var V_SRC;
var thuArray:Array = new Array();
var currentVideo:Number = 0;
var totalItems;
var numOfItems:Number;
var itemDistance:Number = 120+5;
var itemHeight:Number = 80+2;
var Value:Number = 1;
var boundry:Number = 1;
var ratio:Number = 1;
var diff:Number = 1;
var collectionWidth:Number = 1;
var buffer:Number = 135*2;
this.createEmptyMovieClip("video_txt",this.getNextHighestDepth());
video_txt.createTextField("theText",video_txt.getNextHighestDepth(),0,0,584,36);
video_txt.theText.selectable = false;
video_txt.theText.autoSize = "left";
//The Format
myFormat = new TextFormat();
myFormat.font = _root.font_format;
myFormat.size = _root.font_size;
myFormat.color = _root.font_color;
myFormat.align = "center";
video_txt.theText.setNewTextFormat(myFormat);
// Create a new movieclip to load the thumbs
var thumbLoader:MovieClipLoader = new MovieClipLoader();
var thumbListener:Object = new Object();
thumbLoader.addListener(thumbListener);
thumbListener.onLoadInit = function(target_mc:MovieClip, httpStatus:Number)
new Tween(target_mc, "_alpha", Regular.easeOut, 0, 100, 1, true);
target_mc._parent.preloader_mc._alpha = 0;
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = xmlLoaded;
xml.load(xmlFileUrl);
// Load the xml file into the player
function xmlLoaded(b:Boolean) {
if (b) {
auto_play = this.firstChild.firstChild.attributes.auto_play;
scrollSpeed = parseInt(this.firstChild.firstChild.attributes.scrollSpeed);
totalItems = this.firstChild.firstChild.childNodes;
numOfItems = totalItems.length;
for (j=0; j<numOfItems; j++) {
var i = player_mc.main_mc.collection_mc.attachMovie("mc_Thumb", "thumb_"+j, j);
i._x = itemDistance*j;
thumbLoader.loadClip(totalItems[j].attributes.thumb,i.loader_mc);
i.id = j;
i.videoTitle = totalItems[j].attributes.title;
i.videoUrl = totalItems[j].attributes.src;
// Create an event for thumb rollover
i.onRollOver = iRoll;
i.onRollOut = i.onReleaseOutside=iOut;
i.onRelease = iRelease;
thuArray[j] = i;
// default first video
collectionWidth = player_mc.main_mc.collection_mc._width;
currentVideo = 0;
V_SRC = thuArray[0].videoUrl;
changeVideo();
//scope._alpha = 100;
new Tween(scope, "_alpha", Regular.easeOut, 0, 100, 0.5, true);
else
trace("Error! xml file not loaded");
// onRollOver Events
function iRoll() {
player_mc.mc_title.title_txt.htmlText = totalItems[this.id].attributes.title;
this.light_mc.play();
function iRelease() {
currentVideo = this.id;
changeVideo();
function changeVideo() {
V_SRC = thuArray[currentVideo].videoUrl;
player_mc.loadVideo();
currentThumb();
player_mc.mc_title.title_txt.htmlText = thuArray[currentVideo].videoTitle;
video_txt.theText.text = totalItems[currentVideo].attributes.title;
player_mc.so.getVolume();
player_mc.playStatus = 1;
player_mc.checkStatus();
function nextVideo() {
if (currentVideo<(numOfItems-1)) {
currentVideo++;
} else {
currentVideo = 0;
changeVideo();
function currentThumb() {
for (i=0; i<thuArray.length; i++) {
if (i == currentVideo) {
thuArray[i].enabled = true;
// Mouse movement on rollover
this.onMouseMove = function() {
collectionWidth = player_mc.main_mc.collection_mc._width;
boundry = player_mc.main_mc.area_mc._width;
if ((player_mc.main_mc._ymouse>0) && (player_mc.main_mc._ymouse<itemHeight)) {
if ((player_mc.main_mc._xmouse>0) && (player_mc.main_mc._xmouse<boundry)) {
ratio = player_mc.main_mc._xmouse/boundry;
diff = (collectionWidth-boundry)+buffer;
Value = Math.floor((-ratio)*diff)+(buffer/2);
updateAfterEvent();
this.onEnterFrame = function() {
// Define movement area and speed
if (player_mc.main_mc.collection_mc._width>player_mc.main_mc.area_mc._width) {
player_mc.main_mc.collection_mc._x = Math.round((player_mc.main_mc.collection_mc._x)+((Value-player_mc.main_mc.collection_mc._ x)/scrollSpeed));
if (player_mc.main_mc.collection_mc._x>0) {
player_mc.main_mc.collection_mc._x = 0;
} else if (player_mc.main_mc.collection_mc._x<(player_mc.main_mc.area_mc._width-(player_mc.main_mc. collection_mc._width))) {
player_mc.main_mc.collection_mc._x = Math.round(player_mc.main_mc.area_mc._width-(player_mc.main_mc.collection_mc._width));
} else {
player_mc.main_mc.collection_mc._x = 0;
updateAfterEvent();
part two:
// Define flash variables
var video_url:String = "";
var tempx:Number = this._parent._x;
var tempy:Number = this._parent._y;
var timeCounter:Number = 0;
var timeInSeconds:Number = _root.time_counter;
// Object to listen to onStage Event
videoObj = vid.videoObj;
// Setting up the connection
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
// Buffer time
ns.setBufferTime (10);
videoObj.attachVideo (ns);
function loadVideo () {
video_url = _parent.V_SRC;
trace(video_url);
ns.play (video_url);
function checkStatus()
if (playStatus == 1)
controls_mc.playPause.gotoAndStop("pause");
mc_playAgain._visible = false;
thumbs_out = false;
title_out = false;
else
controls_mc.playPause.gotoAndStop("play");
mc_playAgain._visible = true;
} // end else if
if (so.getVolume() == 0)
controls_mc.mute_mc.gotoAndStop("mute");
else
controls_mc.mute_mc.gotoAndStop("on");
}; // End of the function
mc_playAgain._visible = false;
// Check Status of video
ns.onStatus = function (info)
if (info.code == "NetStream.Buffer.Empty")
mc_buffer._visible = true;
else if (info.code == "NetStream.Buffer.Full")
mc_buffer._visible = false;
else if (info.code == "NetStream.Play.Stop")
ns.seek(0);
if (playStatus == 1)
ns.pause();
playStatus = 0;
else
trace;
} // end else if
mc_playAgain._visible = true;
mc_buffer._visible = false;
thumbs_out = true;
title_out = true;
checkStatus();
} // end else if
// Get info about video
ns.onMetaData = function(infoObject:Object)
FLVduration = infoObject["duration"];
relationshipW = infoObject.height / infoObject.width;
relationshipH = infoObject.width / infoObject.height;
if (Stage["displayState"] == "fullScreen")
largeSize ();
else
regularSize ();
if (_parent.auto_play == "false")
ns.seek(0);
if (playStatus == 1)
ns.pause();
playStatus = 0;
mc_buffer._visible = false;
controls_mc.playPause.gotoAndStop("play");
mc_playAgain._visible = true;
thumbs_out = true;
title_out = true;
_parent.auto_play = "true";
}// end else if
var videoInterval = setInterval(videoStatus, 100);
var amountLoaded;
var duration;
// videoStatus on load Event
function videoStatus()
amountLoaded = ns.bytesLoaded / ns.bytesTotal;
controls_mc.mc_progress.mc_buff._width = amountLoaded * 250;
controls_mc.mc_progress.mc_played._x = ns.time / duration * 250;
controls_mc.mc_progress.mc_played._xscale = Math.round(ns.time*100/FLVduration);
}; // End of the function
function scrubIt()
ns.seek(Math.floor(controls_mc.mc_progress.mc_played._x / 250 * duration));
}; // End of the function
// video time
var time_interval:Number = setInterval(checkTime, 500, ns);
function checkTime(ns:NetStream) {
//current time
var ns_seconds:Number = ns.time;
var minutes:Number = Math.floor(ns_seconds/60);
var seconds = Math.floor(ns_seconds%60);
sec = seconds;
min = minutes;
if (sec<10) {
sec = "0"+sec;
if (min<10) {
min = "0"+min;
controls_mc.time_txt.time_1.text = min+":"+sec;
//total time
var minutes2:Number = Math.floor(FLVduration/60);
var seconds2 = Math.floor(FLVduration%60);
sec2 = seconds2;
min2 = minutes2;
if (sec2<10) {
sec2 = "0"+sec2;
if (min2<10) {
min2 = "0"+min2;
controls_mc.time_txt.time_2.text = min2+":"+sec2;
if (controls_mc.time_txt.time_2.text == "NaN:NaN") {
controls_mc.time_txt.time_2.text = "00:00";
setStage ();
// Object to listen onStage Event
var stageL:Object = new Object ();
// function respnsible for content alignment
function setStage ()
if (Stage["displayState"] == "fullScreen") {
tempx = this._parent._x;
tempy = this._parent._y;
this._parent._x = 0;
this._parent._y = 0;
vidBg_mc._x = 0;
vidBg_mc._y = 0;
mc_title._x = 0;
mc_title._y = -30;
slide_me._x = 0;
slide_me._y = 0;
vidBg_mc._width = Stage.width;
vidBg_mc._height = Stage.height;
mc_title._width = Stage.width;
mc_title._height = Stage.height / 20;
slide_me._width = Stage.width;
slide_me._height = Stage.height / 20;
vid._x = vid._y = 0;
largeSize ();
controls_mc._x = Math.round ((Stage.width / 2) - (controls_mc._width / 2));
controls_mc._y = Math.round (Stage.height - 36);
mc_playAgain._x = Math.round ((Stage.width / 2) - (mc_playAgain._width / 2));
mc_playAgain._y = Math.round (Stage.height - 572);
thumbs_mc._x = Math.round ((Stage.width / 2) - (thumbs_mc._width / 2));
thumbs_mc._y = Math.round (Stage.height - 115);
main_mc._x = Math.round ((Stage.width / 2) - (controls_mc._width / 2));;
hide_mc.onEnterFrame = function () {
timeCounter = timeCounter + 1;
if (timeCounter >= timeInSeconds * 30) {
timeCounter = 0;
controls_mc._alpha = 0;
this.onMouseMove = function () {
timeCounter = 0;
controls_mc._alpha = 100;
else
delete hide_mc.onEnterFrame;
delete this.onMouseMove;
controls_mc._alpha = 100;
this._parent._x = tempx;
this._parent._y = tempy;
vidBg_mc._width = 600;
vidBg_mc._height = 360;
mc_title._width = 600;
mc_title._height = 30;
slide_me._width = 600;
slide_me._height = 30;
vidBg_mc._x = vid._x = 0;
vidBg_mc._y = vid._y = 35;
mc_title._x = vid._x = 0;
mc_title._y = vid._x = -30;
slide_me._x = vid._x = 0;
slide_me._y = vid._y = 35;
regularSize ();
controls_mc._x = 0;
controls_mc._y = 395;
mc_playAgain._x = 243;
mc_playAgain._y = 158;
thumbs_mc._x = 0;
thumbs_mc._y = 316;
main_mc._x = 0;
main_mc._y = 406;
mc_buffer._x = Math.round (vidBg_mc._x + (vidBg_mc._width / 2));
mc_buffer._y = Math.round (vidBg_mc._y + (vidBg_mc._height / 2));
// to apply when stage (browser window) is resized or modified
stageL.onResize = function () {
setStage ();
// attaching object to the stage
Stage.addListener (stageL);
MovieClip.prototype.slide = function(yPos) {
this._y -= (this._y-yPos)/5;
// tilte actions
mc_title.onEnterFrame = function()
if (Stage["displayState"] == "normal" && title_out == false)
this.slide(5);
else if (Stage["displayState"] == "normal" && title_out == true)
this.slide(35);
if (Stage["displayState"] == "fullScreen" && title_out == false)
this._y -= (this._y+106)/5;
else if (Stage["displayState"] == "fullScreen" && title_out == true)
this.slide(0);
// thumbs actions
main_mc.onEnterFrame = function()
if (Stage["displayState"] == "normal" && thumbs_out == false)
this.slide(406);
else if (Stage["displayState"] == "normal" && thumbs_out == true)
this.slide(299);
if (Stage["displayState"] == "fullScreen" && thumbs_out == false)
this._y = Math.round (Stage.height - 0);
else if (Stage["displayState"] == "fullScreen" && thumbs_out == true)
this._y = Math.round (Stage.height - 133);
// Playlist button
controls_mc.playlist_mc.onRollOver = function ()
this.gotoAndStop("playlistOver");
controls_mc.playlist_mc.onRollOut = controls_mc.playlist_mc.onReleaseOutside = function ()
this.gotoAndStop("playlist");
// Toggle playlist button
controls_mc.playlist_mc.onRelease = function ()
if (thumbs_out == false)
thumbs_out = true;
title_out = true;
else if (thumbs_out == true)
thumbs_out = false;
title_out = false;
} // end if else
// Define hit area for playPause button
vid.onPress = controls_mc.playPause.onRelease = function ()
ns.pause();
if (playStatus == 1)
controls_mc.playPause.gotoAndStop("play")
playStatus = 0;
checkStatus();
else if (playStatus == 0)
controls_mc.playPause.gotoAndStop("pause");
playStatus = 1;
checkStatus();
// playPause button
controls_mc.playPause.onRollOver = function ()
if (playStatus == 1)
this.gotoAndStop("pauseOver");
else
this.gotoAndStop("playOver");
} // end else if
controls_mc.playPause.onRollOut = controls_mc.playPause.onReleaseOutside = function ()
if (playStatus == 1)
this.gotoAndStop("pause");
else
this.gotoAndStop("play");
} // end else if
// Toggle playPause button
controls_mc.playPause.onRelease = function ()
ns.pause();
if (playStatus == 1)
this.gotoAndStop("play");
playStatus = 0;
checkStatus();
else if (playStatus == 0)
this.gotoAndStop("pause");
playStatus = 1;
checkStatus();
controls_mc.skip_mc.onRollOver = function ()
this.gotoAndStop("skipOver");
controls_mc.skip_mc.onRollOut = controls_mc.skip_mc.onReleaseOutside = function ()
this.gotoAndStop("skip");
controls_mc.skip_mc.onRelease = function ()
_parent.nextVideo()
// Play Again button
mc_playAgain.onRollOver = function ()
this.gotoAndStop("playAgainOver");
mc_playAgain.onRollOut = mc_playAgain.onReleaseOutside = function ()
this.gotoAndStop("playAgain");
// Toggle Play Again button
mc_playAgain.onRelease = function ()
this._visible = false;
ns.pause();
playStatus = 1;
checkStatus();
// make the seek bar clickable
controls_mc.mc_progress.mc_buff.onPress = function()
xpos = controls_mc.mc_progress._xmouse;
percent = Math.round(xpos/controls_mc.mc_progress._width*100);
seekTime = percent/100*FLVduration;
seekTime = Math.round(seekTime*100)/100;
ns.seek(seekTime);
// Set volume level
var s:Sound = new Sound();
s.setVolume(_root.volume_value);
controls_mc.mc_soundLevel.mc_volume._xscale = _root.volume_value;
// Volume control
controls_mc.mc_soundLevel.onPress = function()
volumeTo = (this._xmouse / this._width)*100;
this.mc_volume._xscale = volumeTo;
s.setVolume(volumeTo);
// Volume
_parent.createEmptyMovieClip("vSound", _parent.getNextHighestDepth());
vSound.attachAudio(ns);
var so = new Sound(vSound);
so.setVolume(_root.volume_value);
// Mute button
controls_mc.mute_mc.onRollOver = function ()
if (so.getVolume() >= 1)
this.gotoAndStop("onOver");
else
this.gotoAndStop("muteOver");
} // end else if
controls_mc.mute_mc.onRollOut = controls_mc.mute_mc.onReleaseOutside = function ()
if (so.getVolume() >= 1)
this.gotoAndStop("on");
else
this.gotoAndStop("mute");
} // end else if
// Toggle mute button
controls_mc.mute_mc.onRelease = function ()
if (so.getVolume() >= 1)
controls_mc.mc_soundLevel.mc_volume._xscale = 0;
so.setVolume(0);
this.gotoAndStop("muteOver");
else
controls_mc.mc_soundLevel.mc_volume._xscale = 70;
so.setVolume(_root.volume_value);
this.gotoAndStop("onOver");
} // end else if
// Resize video proportionaly
function regularSize ()
videoObj._width = 600;
videoObj._height = videoObj._width * relationshipW;
if (videoObj._height > 360)
videoObj._height = 360;
videoObj._width = videoObj._height * relationshipH;
videoObj.smoothing = true;
//var scale:Number;
videoObj._x = (600 - videoObj._width) / 2;
videoObj._y = (360 - videoObj._height) / 2;
function largeSize ()
videoObj._width = Stage.width;
videoObj._height = videoObj._width * relationshipW;
if (videoObj._height > Stage.height)
videoObj._height = Stage.height;
videoObj._width = videoObj._height * relationshipH;
videoObj.smoothing = true;
//var scale:Number;
videoObj._x = (Stage.width - videoObj._width) / 2;
videoObj._y = (Stage.height - videoObj._height) / 2;
// Fullscreen button
controls_mc.fullscreen_mc.onRollOver = function ()
if (Stage["displayState"] == "normal")
this.gotoAndStop("fullOver");
else
this.gotoAndStop("fullCloseOver");
} // end else if
controls_mc.fullscreen_mc.onRollOut = controls_mc.fullscreen_mc.onReleaseOutside = function ()
if (Stage["displayState"] == "normal")
this.gotoAndStop("full");
else
this.gotoAndStop("fullClose");
} // end else if
// Toggle fullscreen button
controls_mc.fullscreen_mc.onRelease = function ()
if (Stage["displayState"] == "normal")
Stage["displayState"] = "fullscreen";
_parent.video_txt.theText._visible = false;
else
Stage["displayState"] = "normal";
_parent.video_txt.theText._visible = true;if you mean sound works well when the gallery is tested without being loaded into another swf but fails when loaded, change the highlighted line:
// Import filter classes
import mx.transitions.Tween;
import mx.transitions.easing.*;
// Set flash variables
var xmlFileUrl:String = "playlist.xml";
var auto_play:String = "true";
// Set xml file URL
if (_root.xmlfile) {
xmlFileUrl = _root.xmlfile;
var V_SRC;
var thuArray:Array = new Array();
var currentVideo:Number = 0;
var totalItems;
var numOfItems:Number;
var itemDistance:Number = 120+5;
var itemHeight:Number = 80+2;
var Value:Number = 1;
var boundry:Number = 1;
var ratio:Number = 1;
var diff:Number = 1;
var collectionWidth:Number = 1;
var buffer:Number = 135*2;
this.createEmptyMovieClip("video_txt",this.getNextHighestDepth());
video_txt.createTextField("theText",video_txt.getNextHighestDepth(),0,0,584,36);
video_txt.theText.selectable = false;
video_txt.theText.autoSize = "left";
//The Format
myFormat = new TextFormat();
myFormat.font = _root.font_format;
myFormat.size = _root.font_size;
myFormat.color = _root.font_color;
myFormat.align = "center";
video_txt.theText.setNewTextFormat(myFormat);
// Create a new movieclip to load the thumbs
var thumbLoader:MovieClipLoader = new MovieClipLoader();
var thumbListener:Object = new Object();
thumbLoader.addListener(thumbListener);
thumbListener.onLoadInit = function(target_mc:MovieClip, httpStatus:Number)
new Tween(target_mc, "_alpha", Regular.easeOut, 0, 100, 1, true);
target_mc._parent.preloader_mc._alpha = 0;
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = xmlLoaded;
xml.load(xmlFileUrl);
// Load the xml file into the player
function xmlLoaded(b:Boolean) {
if (b) {
auto_play = this.firstChild.firstChild.attributes.auto_play;
scrollSpeed = parseInt(this.firstChild.firstChild.attributes.scrollSpeed);
totalItems = this.firstChild.firstChild.childNodes;
numOfItems = totalItems.length;
for (j=0; j<numOfItems; j++) {
var i = player_mc.main_mc.collection_mc.attachMovie("mc_Thumb", "thumb_"+j, j);
i._x = itemDistance*j;
thumbLoader.loadClip(totalItems[j].attributes.thumb,i.loader_mc);
i.id = j;
i.videoTitle = totalItems[j].attributes.title;
i.videoUrl = totalItems[j].attributes.src;
// Create an event for thumb rollover
i.onRollOver = iRoll;
i.onRollOut = i.onReleaseOutside=iOut;
i.onRelease = iRelease;
thuArray[j] = i;
// default first video
collectionWidth = player_mc.main_mc.collection_mc._width;
currentVideo = 0;
V_SRC = thuArray[0].videoUrl;
changeVideo();
//scope._alpha = 100;
new Tween(scope, "_alpha", Regular.easeOut, 0, 100, 0.5, true);
else
trace("Error! xml file not loaded");
// onRollOver Events
function iRoll() {
player_mc.mc_title.title_txt.htmlText = totalItems[this.id].attributes.title;
this.light_mc.play();
function iRelease() {
currentVideo = this.id;
changeVideo();
function changeVideo() {
V_SRC = thuArray[currentVideo].videoUrl;
player_mc.loadVideo();
currentThumb();
player_mc.mc_title.title_txt.htmlText = thuArray[currentVideo].videoTitle;
video_txt.theText.text = totalItems[currentVideo].attributes.title;
player_mc.so.getVolume();
player_mc.playStatus = 1;
player_mc.checkStatus();
function nextVideo() {
if (currentVideo<(numOfItems-1)) {
currentVideo++;
} else {
currentVideo = 0;
changeVideo();
function currentThumb() {
for (i=0; i<thuArray.length; i++) {
if (i == currentVideo) {
thuArray[i].enabled = true;
// Mouse movement on rollover
this.onMouseMove = function() {
collectionWidth = player_mc.main_mc.collection_mc._width;
boundry = player_mc.main_mc.area_mc._width;
if ((player_mc.main_mc._ymouse>0) && (player_mc.main_mc._ymouse<itemHeight)) {
if ((player_mc.main_mc._xmouse>0) && (player_mc.main_mc._xmouse<boundry)) {
ratio = player_mc.main_mc._xmouse/boundry;
diff = (collectionWidth-boundry)+buffer;
Value = Math.floor((-ratio)*diff)+(buffer/2);
updateAfterEvent();
this.onEnterFrame = function() {
// Define movement area and speed
if (player_mc.main_mc.collection_mc._width>player_mc.main_mc.area_mc._width) {
player_mc.main_mc.collection_mc._x = Math.round((player_mc.main_mc.collection_mc._x)+((Value-player_mc.main_mc.colle ction_mc._x)/scrollSpeed));
if (player_mc.main_mc.collection_mc._x>0) {
player_mc.main_mc.collection_mc._x = 0;
} else if (player_mc.main_mc.collection_mc._x<(player_mc.main_mc.area_mc._width-(player_m c.main_mc.collection_mc._width))) {
player_mc.main_mc.collection_mc._x = Math.round(player_mc.main_mc.area_mc._width-(player_mc.main_mc.collection_mc._w idth));
} else {
player_mc.main_mc.collection_mc._x = 0;
updateAfterEvent();
part two:
// Define flash variables
var video_url:String = "";
var tempx:Number = this._parent._x;
var tempy:Number = this._parent._y;
var timeCounter:Number = 0;
var timeInSeconds:Number = _root.time_counter;
// Object to listen to onStage Event
videoObj = vid.videoObj;
// Setting up the connection
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
// Buffer time
ns.setBufferTime (10);
videoObj.attachVideo (ns);
function loadVideo () {
video_url = _parent.V_SRC;
trace(video_url);
ns.play (video_url);
function checkStatus()
if (playStatus == 1)
controls_mc.playPause.gotoAndStop("pause");
mc_playAgain._visible = false;
thumbs_out = false;
title_out = false;
else
controls_mc.playPause.gotoAndStop("play");
mc_playAgain._visible = true;
} // end else if
if (so.getVolume() == 0)
controls_mc.mute_mc.gotoAndStop("mute");
else
controls_mc.mute_mc.gotoAndStop("on");
}; // End of the function
mc_playAgain._visible = false;
// Check Status of video
ns.onStatus = function (info)
if (info.code == "NetStream.Buffer.Empty")
mc_buffer._visible = true;
else if (info.code == "NetStream.Buffer.Full")
mc_buffer._visible = false;
else if (info.code == "NetStream.Play.Stop")
ns.seek(0);
if (playStatus == 1)
ns.pause();
playStatus = 0;
else
trace;
} // end else if
mc_playAgain._visible = true;
mc_buffer._visible = false;
thumbs_out = true;
title_out = true;
checkStatus();
} // end else if
// Get info about video
ns.onMetaData = function(infoObject:Object)
FLVduration = infoObject["duration"];
relationshipW = infoObject.height / infoObject.width;
relationshipH = infoObject.width / infoObject.height;
if (Stage["displayState"] == "fullScreen")
largeSize ();
else
regularSize ();
if (_parent.auto_play == "false")
ns.seek(0);
if (playStatus == 1)
ns.pause();
playStatus = 0;
mc_buffer._visible = false;
controls_mc.playPause.gotoAndStop("play");
mc_playAgain._visible = true;
thumbs_out = true;
title_out = true;
_parent.auto_play = "true";
}// end else if
var videoInterval = setInterval(videoStatus, 100);
var amountLoaded;
var duration;
// videoStatus on load Event
function videoStatus()
amountLoaded = ns.bytesLoaded / ns.bytesTotal;
controls_mc.mc_progress.mc_buff._width = amountLoaded * 250;
controls_mc.mc_progress.mc_played._x = ns.time / duration * 250;
controls_mc.mc_progress.mc_played._xscale = Math.round(ns.time*100/FLVduration);
}; // End of the function
function scrubIt()
ns.seek(Math.floor(controls_mc.mc_progress.mc_played._x / 250 * duration));
}; // End of the function
// video time
var time_interval:Number = setInterval(checkTime, 500, ns);
function checkTime(ns:NetStream) {
//current time
var ns_seconds:Number = ns.time;
var minutes:Number = Math.floor(ns_seconds/60);
var seconds = Math.floor(ns_seconds%60);
sec = seconds;
min = minutes;
if (sec<10) {
sec = "0"+sec;
if (min<10) {
min = "0"+min;
controls_mc.time_txt.time_1.text = min+":"+sec;
//total time
var minutes2:Number = Math.floor(FLVduration/60);
var seconds2 = Math.floor(FLVduration%60);
sec2 = seconds2;
min2 = minutes2;
if (sec2<10) {
sec2 = "0"+sec2;
if (min2<10) {
min2 = "0"+min2;
controls_mc.time_txt.time_2.text = min2+":"+sec2;
if (controls_mc.time_txt.time_2.text == "NaN:NaN") {
controls_mc.time_txt.time_2.text = "00:00";
setStage ();
// Object to listen onStage Event
var stageL:Object = new Object ();
// function respnsible for content alignment
function setStage ()
if (Stage["displayState"] == "fullScreen") {
tempx = this._parent._x;
tempy = this._parent._y;
this._parent._x = 0;
this._parent._y = 0;
vidBg_mc._x = 0;
vidBg_mc._y = 0;
mc_title._x = 0;
mc_title._y = -30;
slide_me._x = 0;
slide_me._y = 0;
vidBg_mc._width = Stage.width;
vidBg_mc._height = Stage.height;
mc_title._width = Stage.width;
mc_title._height = Stage.height / 20;
slide_me._width = Stage.width;
slide_me._height = Stage.height / 20;
vid._x = vid._y = 0;
largeSize ();
controls_mc._x = Math.round ((Stage.width / 2) - (controls_mc._width / 2));
controls_mc._y = Math.round (Stage.height - 36);
mc_playAgain._x = Math.round ((Stage.width / 2) - (mc_playAgain._width / 2));
mc_playAgain._y = Math.round (Stage.height - 572);
thumbs_mc._x = Math.round ((Stage.width / 2) - (thumbs_mc._width / 2));
thumbs_mc._y = Math.round (Stage.height - 115);
main_mc._x = Math.round ((Stage.width / 2) - (controls_mc._width / 2));;
hide_mc.onEnterFrame = function () {
timeCounter = timeCounter + 1;
if (timeCounter >= timeInSeconds * 30) {
timeCounter = 0;
controls_mc._alpha = 0;
this.onMouseMove = function () {
timeCounter = 0;
controls_mc._alpha = 100;
else
delete hide_mc.onEnterFrame;
delete this.onMouseMove;
controls_mc._alpha = 100;
this._parent._x = tempx;
this._parent._y = tempy;
vidBg_mc._width = 600;
vidBg_mc._height = 360;
mc_title._width = 600;
mc_title._height = 30;
slide_me._width = 600;
slide_me._height = 30;
vidBg_mc._x = vid._x = 0;
vidBg_mc._y = vid._y = 35;
mc_title._x = vid._x = 0;
mc_title._y = vid._x = -30;
slide_me._x = vid._x = 0;
slide_me._y = vid._y = 35;
regularSize ();
controls_mc._x = 0;
controls_mc._y = 395;
mc_playAgain._x = 243;
mc_playAgain._y = 158;
thumbs_mc._x = 0;
thumbs_mc._y = 316;
main_mc._x = 0;
main_mc._y = 406;
mc_buffer._x = Math.round (vidBg_mc._x + (vidBg_mc._width / 2));
mc_buffer._y = Math.round (vidBg_mc._y + (vidBg_mc._height / 2));
// to apply when stage (browser window) is resized or modified
stageL.onResize = function () {
setStage ();
// attaching object to the stage
Stage.addListener (stageL);
MovieClip.prototype.slide = function(yPos) {
this._y -= (this._y-yPos)/5;
// tilte actions
mc_title.onEnterFrame = function()
if (Stage["displayState"] == "normal" && title_out == false)
this.slide(5);
else if (Stage["displayState"] == "normal" && title_out == true)
this.slide(35);
if (Stage["displayState"] == "fullScreen" && title_out == false)
this._y -= (this._y+106)/5;
else if (Stage["displayState"] == "fullScreen" && title_out == true)
this.slide(0);
// thumbs actions
main_mc.onEnterFrame = function()
if (Stage["displayState"] == "normal" && thumbs_out == false)
this.slide(406);
else if (Stage["displayState"] == "normal" && thumbs_out == true)
this.slide(299);
if (Stage["displayState"] == "fullScreen" && thumbs_out == false)
this._y = Math.round (Stage.height - 0);
else if (Stage["displayState"] == "fullScreen" && thumbs_out == true)
this._y = Math.round (Stage.height - 133);
// Playlist button
controls_mc.playlist_mc.onRollOver = function ()
this.gotoAndStop("playlistOver");
controls_mc.playlist_mc.onRollOut = controls_mc.playlist_mc.onReleaseOutside = function ()
this.gotoAndStop("playlist");
// Toggle playlist button
controls_mc.playlist_mc.onRelease = function ()
if (thumbs_out == false)
thumbs_out = true;
title_out = true;
else if (thumbs_out == true)
thumbs_out = false;
title_out = false;
} // end if else
// Define hit area for playPause button
vid.onPress = controls_mc.playPause.onRelease = function ()
ns.pause();
if (playStatus == 1)
controls_mc.playPause.gotoAndStop("play")
playStatus = 0;
checkStatus();
else if (playStatus == 0)
controls_mc.playPause.gotoAndStop("pause");
playStatus = 1;
checkStatus();
// playPause button
controls_mc.playPause.onRollOver = function ()
if (playStatus == 1)
this.gotoAndStop("pauseOver");
else
this.gotoAndStop("playOver");
} // end else if
controls_mc.playPause.onRollOut = controls_mc.playPause.onReleaseOutside = function ()
if (playStatus == 1)
this.gotoAndStop("pause");
else
this.gotoAndStop("play");
} // end else if
// Toggle playPause button
controls_mc.playPause.onRelease = function ()
ns.pause();
if (playStatus == 1)
this.gotoAndStop("play");
playStatus = 0;
checkStatus();
else if (playStatus == 0)
this.gotoAndStop("pause");
playStatus = 1;
checkStatus();
controls_mc.skip_mc.onRollOver = function ()
this.gotoAndStop("skipOver");
controls_mc.skip_mc.onRollOut = controls_mc.skip_mc.onReleaseOutside = function ()
this.gotoAndStop("skip");
controls_mc.skip_mc.onRelease = function ()
_parent.nextVideo()
// Play Again button
mc_playAgain.onRollOver = function ()
this.gotoAndStop("playAgainOver");
mc_playAgain.onRollOut = mc_playAgain.onReleaseOutside = function ()
this.gotoAndStop("playAgain");
// Toggle Play Again button
mc_playAgain.onRelease = function ()
this._visible = false;
ns.pause();
playStatus = 1;
checkStatus();
// make the seek bar clickable
controls_mc.mc_progress.mc_buff.onPress = function()
xpos = controls_mc.mc_progress._xmouse;
percent = Math.round(xpos/controls_mc.mc_progress._width*100);
seekTime = percent/100*FLVduration;
seekTime = Math.round(seekTime*100)/100;
ns.seek(seekTime);
// Set volume level
var s:Sound = new Sound(this);
s.setVolume(_root.volume_value);
controls_mc.mc_soundLevel.mc_volume._xscale = _root.volume_value;
// Volume control
controls_mc.mc_soundLevel.onPress = function()
volumeTo = (this._xmouse / this._width)*100;
this.mc_volume._xscale = volumeTo;
s.setVolume(volumeTo);
// Volume
_parent.createEmptyMovieClip("vSound", _parent.getNextHighestDepth());
vSound.attachAudio(ns);
var so = new Sound(vSound);
so.setVolume(_root.volume_value);
// Mute button
controls_mc.mute_mc.onRollOver = function ()
if (so.getVolume() >= 1)
this.gotoAndStop("onOver");
else
this.gotoAndStop("muteOver");
} // end else if
controls_mc.mute_mc.onRollOut = controls_mc.mute_mc.onReleaseOutside = function ()
if (so.getVolume() >= 1)
this.gotoAndStop("on");
else
this.gotoAndStop("mute");
} // end else if
// Toggle mute button
controls_mc.mute_mc.onRelease = function ()
if (so.getVolume() >= 1)
controls_mc.mc_soundLevel.mc_volume._xscale = 0;
so.setVolume(0);
this.gotoAndStop("muteOver");
else
controls_mc.mc_soundLevel.mc_volume._xscale = 70;
so.setVolume(_root.volume_value);
this.gotoAndStop("onOver");
} // end else if
// Resize video proportionaly
function regularSize ()
videoObj._width = 600;
videoObj._height = videoObj._width * relationshipW;
if (videoObj._height > 360)
videoObj._height = 360;
videoObj._width = videoObj._height * relationshipH;
videoObj.smoothing = true;
//var scale:Number;
videoObj._x = (600 - videoObj._width) / 2;
videoObj._y = (360 - videoObj._height) / 2;
function largeSize ()
videoObj._width = Stage.width;
videoObj._height = videoObj._width * relationshipW;
if (videoObj._height > Stage.height)
videoObj._height = Stage.height;
videoObj._width = videoObj._height * relationshipH;
videoObj.smoothing = true;
//var scale:Number;
videoObj._x = (Stage.width - videoObj._width) / 2;
videoObj._y = (Stage.height - videoObj._height) / 2;
// Fullscreen button
controls_mc.fullscreen_mc.onRollOver = function ()
if (Stage["displayState"] == "normal")
this.gotoAndStop("fullOver");
else
this.gotoAndStop("fullCloseOver");
} // end else if
controls_mc.fullscreen_mc.onRollOut = controls_mc.fullscreen_mc.onReleaseOutside = function ()
if (Stage["displayState"] == "normal")
this.gotoAndStop("full");
else
this.gotoAndStop("fullClose");
} // end else if
// Toggle fullscreen button
controls_mc.fullscreen_mc.onRelease = function ()
if (Stage["displayState"] == "normal")
Stage["displayState"] = "fullscreen";
_parent.video_txt.theText._visible = false;
else
Stage["displayState"] = "normal";
_parent.video_txt.theText._visible = true;
Maybe you are looking for
-
Tracking Daily Stock Qty. in Z Report
Hi, I have a query. I want to track Daily Stock of a particular Material as on the posting date of that report i.e. date when i will run the report. Getting a period wise Report is not a problem, but getting it as on date is a problem. Need support f
-
Messages are not showing in the moni
hi..... i am doing rfc - soap scenario, in the sender communication channel monitoring it was showing success, in the receiver communication channel monitoring it was showing status is Yellow colour (Channel Started but inactive) and not found any me
-
How do I reference a .js file in .html on iweb to be viewed online!
OK, I have a B-Ball Stat sheet I am trying to post on my website. I create the stats in excel and export the sheet to .html from there I copy the .html code and paste it in a HTML Snippet. This works GREAT! NOW I am trying to link this code to a .js
-
Download Manager-Showing Download in Progress, but nothing being downloaded
I am trying to download 7.10 GUI. The DM is able to connect to the Marketplace and gives the message that download in progress.But at the bottom giving another message "The request failed 401/An error occured while reading the object from the marketp
-
Hello, We use Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production on Solaris 8 2/02 s28s_u7wos_08a Generic_112953-02 on a SunFire 15k. To achieve better performance, we want to lock Oracle memory in OS RAM. This is normaly done using LOC